'sp_tabbed_sidebar', 'description' => __( 'Tabbed posts, comments and tags.', 'biscaya' ), ); $this->WP_Widget('sp_tabbed_sidebar', '» Wow Tabbed', $widget_args); add_action( 'sp_tabbed_sidebar_tab-latest', array( &$this, 'latest_tab' ) ); add_action( 'sp_tabbed_sidebar_tab-random', array( &$this, 'random_tab' ) ); add_action( 'sp_tabbed_sidebar_tab-comments', array( &$this, 'comments_tab' ) ); add_action( 'sp_tabbed_sidebar_tab-tags', array( &$this, 'tags_tab' ) ); if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_head', array( &$this, 'load_js' ) ); } } /** * load_js function. */ public function load_js() { wp_enqueue_script( 'jquery-ui-tabs', null, array( 'jquery-ui-core', 'jquery' ), null, false ); wp_enqueue_script( 'biscaya-tabwidget', null, false ); } /** * get_tabs function. */ public function get_tabs() { $_default_tabs = array( 'latest' => __( 'Latest', 'biscaya' ), 'random' => __( 'Random', 'biscaya' ), 'comments' => __( 'Comments', 'biscaya' ), 'tags' => __( 'Tags', 'biscaya' ), ); return apply_filters( 'sp_tabbed_sidebar_tabs', $_default_tabs ); } /** * widget function. */ public function widget( $args, $instance ) { global $wpdb; extract( $args, EXTR_SKIP ); $this->postcount = $instance[ 'postcount' ]; $this->commentcount = $instance[ 'commentcount' ]; $this->display_thumbs = $instance[ 'display_thumbs' ]; if ( !$instance[ 'order' ] ) $instance[ 'order' ] = $this->get_tabs(); if ( $instance[ 'display_home' ] && !is_home() ) return false; ?> $this->display_thumbs, 'show_excerpt' => false, 'query' => array ( 'posts_per_page' => $this->postcount ) ) ); } public function random_tab() { biscaya_widgets_post_loop( 'sidebar-random', array( 'show_thumbs' => $this->display_thumbs, 'show_excerpt' => false, 'query' => array ( 'posts_per_page' => $this->postcount, 'orderby' => 'rand', ) ) ); } public function comments_tab() { $comments = get_comments( array( 'status' => 'approve', 'number' => $this->commentcount ) ); if ($comments) { echo ''; } } public function tags_tab() { echo '
'; if ( function_exists( 'wp_cumulus_insert' ) ) { $args = array( 'width' => 280, 'height' => 280 ); wp_cumulus_insert( $args ); } else { wp_tag_cloud(); } echo '
'; } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance[ 'order' ] = $new_instance[ 'order' ]; $instance[ 'display_home' ] = ( boolean )( $new_instance[ 'display_home' ] ); $instance[ 'display_thumbs' ] = ( boolean )( $new_instance[ 'display_thumbs' ] ); $instance[ 'postcount' ] = $new_instance[ 'postcount' ]; $instance[ 'commentcount' ] = $new_instance[ 'commentcount' ]; return $instance; } public function form( $instance ) { $instance = wp_parse_args( ( array )$instance, array ( 'order' => array ( 'latest', 'random', 'comments', 'tags' ), 'display_home' => false, 'display_thumbs' => true, 'postcount' => 8, 'commentcount' => 8 ) ); $order = $instance[ 'order' ]; ?>






/>

get_tabs(); if ( !$selected ) $selected = $default; foreach ( $opts as $id => $val ) { echo ''; } } public function render_sidebar_tabs( $order ) { $order = array_unique( $order ); $list = $this->get_tabs(); foreach ( $order as $t => $id ) : ?>
  • 'category', 'show_thumbs' => true, 'show_excerpt' => true, 'query' => array ( 'post_type' => 'post', 'posts_per_page' => 5, 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => 1, ) ); $args[ 'query' ] = wp_parse_args( $args[ 'query' ], $_defaults[ 'query' ] ); $args = wp_parse_args( $args, $_defaults ); $q = new WP_Query( $args[ 'query' ] ); if ( $q->have_posts() ) { echo '