Сначала создайте шорткод "tabs"
function tabs_shortcode( $atts, $content ) {
$atts = shortcode_atts( array(
'id' => ''
), $atts );
extract ($atts); // gives you the ability to use array keys as variables
return '<ul id="'. $id.'">'. do_shortcode( $content ) .'</ul>';
}
add_shortcode( 'tabs', 'tabs_shortcode' );
Теперь создайте шорткод "tab"
function tab_shortcode( $atts, $content ) {
$atts = shortcode_atts( array(
'id' => ''
), $atts );
extract ($atts); // gives you the ability to use array keys as variables
return '<li id="'. $id.'">'. do_shortcode( $content ) .'</li>';
}
add_shortcode( 'tab', 'tab_shortcode' );
Используйте его вот так
[tabs id="tab"]
[tab id="tab1"] lorem ipsum dolor [/tab]
[tab id="tab2"] lorem ipsum dolor [/tab]
[tab id="tab3"] lorem ipsum dolor [/tab]
[/tab]