/* Tabs Shortcodes
/*-----------------------------------------------------------------------------------*/
if (!function_exists('zilla_tabs')) {
function zilla_tabs( $atts, $content = null ) {
$defaults = array();
extract( shortcode_atts( $defaults, $atts ) );
STATIC $i = 0;
$i++;
// Extract the tab titles for use in the tab widget.
preg_match_all( '/tab title="([^\"]+)"/i', $content, $matches, PREG_OFFSET_CAPTURE );
$tab_titles = array();
if( isset($matches[1]) ){ $tab_titles = $matches[1]; }
$output = '';
if( count($tab_titles) ){
$output .= '<div id="zilla-tabs-'. $i .'" class="zilla-tabs"><div class="zilla-tab-inner">';
$output .= '<ul class="zilla-nav zilla-clearfix">';
foreach( $tab_titles as $tab ){
$output .= '<li><a href="#zilla-tab-'. sanitize_title( $tab[0] ) .'">' . $tab[0] . '</a></li>';
}
$output .= '</ul>';
$output .= do_shortcode( $content );
$output .= '</div></div>';
} else {
$output .= do_shortcode( $content );
}
return $output;
}
add_shortcode( 'zilla_tabs', 'zilla_tabs' );
}
if (!function_exists('zilla_tab')) {
function zilla_tab( $atts, $content = null ) {
$defaults = array( 'title' => 'Tab' );
extract( shortcode_atts( $defaults, $atts ) );
return '<div id="zilla-tab-'. sanitize_title( $title ) .'" class="zilla-tab">'. do_shortcode( $content ) .'</div>';
}
add_shortcode( 'zilla_tab', 'zilla_tab' );
}
?>