I use this in my Functions.php file to format short codes for some jQuery UI tabs, however I also use a short tag to reference my video embeds, which breaks when they're inside the UI tabs.
My question is, how would I just pass my video short code through this function unaltered:
// jQuery UI Tabs
add_shortcode( 'tabgroup', 'etdc_tab_group' );
function etdc_tab_group( $atts, $content ){
$GLOBALS['tab_count'] = 0;
do_shortcode( $content );
if( is_array( $GLOBALS['tabs'] ) ){
foreach( $GLOBALS['tabs'] as $tab ){
$tabs[] = '<li><a class="" href="#'.$tab['title'].'">'.$tab['title'].'</a></li>';
$panes[] = '<div id="'.$tab['title'].'"><h3>'.$tab['title'].'</h3>'.$tab['content'].'</div>';
}
$return = "\n".'<!-- the tabs --><div id="tabs"><ul>'.implode( "\n", $tabs ).'</ul>'."\n".'<!-- tab "panes" -->'.implode( "\n", $panes ).'</div>'."\n";
}
return $return;
}
add_shortcode( 'tab', 'etdc_tab' );
function etdc_tab( $atts, $content ){
extract(shortcode_atts(array(
'title' => 'Tab %d'
), $atts));
$x = $GLOBALS['tab_count'];
$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
$GLOBALS['tab_count']++;
}
My video short code looks like this [video src="http://site.com/uploads/example.mp4"]. I imagine I just have to set something in $GLOBALS, but I don't know how I would just pass it through unaltered.
(My 'video' short code is being translated by another plugin)
Update: This was the solution to my problem. Adding do_shortcode
to $panes:
$panes[] = '<div id="'.$tab['title'].'"><h3>'.$tab['title'].'</h3>'.do_shortcode($tab['content']).'</div>';