functions.php
// custom tabs
$tabs_divs = '';
function tabs_group($atts, $content = null ) {
global $tabs_divs;
$tabs_divs = '';
$output = '<div class="nls_tabs">';
$output.= '<ul class="tab-links">' . do_shortcode($content) . '</ul>';
$output.= '<div class="tab-content">'.$tabs_divs.'</div>';
return $output;
}
function tab($atts, $content = null) {
global $tabs_divs;
extract(shortcode_atts(array(
'id' => '',
'title' => '',
), $atts));
if(empty($id))
$id = 'side-tab'.rand(100,999);
$output = '<li><a href="#'.$id.'">'.$title.'</a></li>';
$tabs_divs.= '<div id="'.$id.'" class="nls_tab">'.$content.'</div>';
return $output;
}
add_shortcode('nls_tabs', 'tabs_group');
add_shortcode('nls_tab', 'tab');