Skip to content

Documentation

Extensive Documentation for PowerPack & WooPack to help you with common questions and issues.

PowerPack

⌘K
  1. Home
  2. Docs
  3. PowerPack
  4. Modules
  5. Advanced Tabs
  6. How to remove tabs with no content?

How to remove tabs with no content?

If there are tabs that don’t have any content or rely on a shortcode that doesn’t render any content, you can hide those tabs dynamically using the code below:

// PowerPack Advanced Tabs: Do not render tabs if the tab content is empty.
add_filter( 'pp_tabs_items', function( $items, $settings ) {
  foreach ( $items as $key => $item ) {
    $content = do_shortcode( $item->content );
    $content = preg_replace( '/<p><\/p>/', '', $content );
    if ( empty( trim( $content ) ) ) {
       unset( $items[ $key ] );
    }
  }
  return array_values( $items );
}, 10, 2 );

You just need to insert this code into your current child theme’s functions.php file.

PowerPack Beaver Addons Black Friday Deal
Our Biggest Sale of the Year
Save up to 50% OFF

Wait! Don't Miss Our Biggest Sale of the Year!

SAVE UP TO 50% OFF

Get premium Beaver Builder addons at our lowest prices of the year. Build better websites for less!

Limited-time offer • Don't miss out!

×