Title: shortcode in tab content shortcode
Last modified: February 12, 2020

---

# shortcode in tab content shortcode

 *  Resolved [virtual21](https://wordpress.org/support/users/virtual21/)
 * (@virtual21)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/shortcode-in-tab-content-shortcode/)
 * I retrieve tabs content for each product with this shortcode [https://wordpress.org/support/topic/tab-content-shortcode/](https://wordpress.org/support/topic/tab-content-shortcode/),
   
   but some tabs contain one or more shortcodes and when the value $tab[‘content’]
   is displayed, it only shows the unresolved shortcode [gallery ...].
 * I appreciate the help you can provide

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Freddie](https://wordpress.org/support/users/fmixell/)
 * (@fmixell)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/shortcode-in-tab-content-shortcode/#post-12426673)
 * Most likely you just need to run the content through the content filter, try 
   it out with this modification.
 *     ```
       function yikes_custom_product_tabs_shortcode( $args ) {
       	global $post;
   
       	// Define our default values
       	$defaults = array(
       		'product_id' => $post->ID,
       		'tab_number' => 'all',
       	);
   
       	// Let the user-defined values override our defaults
       	$values = is_array( $args ) ? array_merge( $defaults, $args ) : $defaults;
   
       	// Make sure we have a product ID and that the product ID is for a product 
       	if ( empty( $values['product_id'] ) || ! empty( $values['product_id'] ) && get_post_type( $values['product_id'] ) !== 'product' ) {
       		return;
       	}
   
       	// Fetch our tabs
       	$tabs = get_post_meta( $values['product_id'], 'yikes_woo_products_tabs', true );
   
       	// Get just the specified tab. (minus tab number by one so it starts at 0)
       	$tabs = absint( $values['tab_number'] ) < 1 ? $tabs : ( isset( $tabs[ absint( $values['tab_number'] ) - 1 ] ) ? array( $tabs[ absint( $values['tab_number'] ) - 1 ] ) : array() );
   
       	if ( empty( $tabs ) ) {
       		return;
       	}
   
       	// Debug statement to show all tab data. Feel free to remove.
       	// echo '<pre>'; var_dump( $tabs ); echo '</pre>';
   
       	$html = '';
   
       	// Loop through the tabs and display each one
       	foreach( $tabs as $tab ) {
       		$html .= '<p>' . $tab['title'] . '</p>';
   
       		$html .= '<p>' . apply_filters( 'the_content', $tab['content'] ) . '</p>';
       	}
   
       	// Make sure to return your content, do not echo it.
       	return $html;
       }
   
       add_shortcode( 'custom_product_tabs', 'yikes_custom_product_tabs_shortcode' );
       ```
   
 * That should work for you because it will call the `do_shortcode` function for
   you
 *  Thread Starter [virtual21](https://wordpress.org/support/users/virtual21/)
 * (@virtual21)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/shortcode-in-tab-content-shortcode/#post-12428180)
 * Cool!
 * it worked!!!
 * Thanks!
 *  [Freddie](https://wordpress.org/support/users/fmixell/)
 * (@fmixell)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/shortcode-in-tab-content-shortcode/#post-12428337)
 * [@virtual21](https://wordpress.org/support/users/virtual21/),
 * Awesome, I’m glad that worked out for you!
 * If you’re enjoying Custom Product Tabs and you have a moment could you [leave us a review?](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/#new-post)
 * Cheers,
    Freddie

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘shortcode in tab content shortcode’ is closed to new replies.

 * ![](https://ps.w.org/yikes-inc-easy-custom-woocommerce-product-tabs/assets/icon-
   256x256.png?rev=1558461)
 * [Custom Product Tabs for WooCommerce](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Active Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 2 participants
 * Last reply from: [Freddie](https://wordpress.org/support/users/fmixell/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/shortcode-in-tab-content-shortcode/#post-12428337)
 * Status: resolved