Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    (@virtual21)

    Cool!

    it worked!!!

    Thanks!

    @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?

    Cheers,
    Freddie

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘shortcode in tab content shortcode’ is closed to new replies.