esc_html__('List posts, comments, and/or tags with or without tabs.', 'blogside' ), 'classname' => 'widget_blogside_tabs', 'customize_selective_refresh' => true ) ); } public function blogside_get_defaults() { return array( 'title' => '', 'tabs_category' => 1, 'tabs_date' => 1, // Recent posts 'recent_enable' => 1, 'recent_thumbs' => 1, 'recent_cat_id' => '0', 'recent_num' => '5', // Popular posts 'popular_enable' => 1, 'popular_thumbs' => 1, 'popular_cat_id' => '0', 'popular_time' => '0', 'popular_num' => '5', // Recent comments 'comments_enable' => 1, 'comments_avatars' => 1, 'comments_num' => '5', // Tags 'tags_enable' => 1, // Order 'order_recent' => '1', 'order_popular' => '2', 'order_comments' => '3', 'order_tags' => '4', ); } /* Create tabs-nav /* ------------------------------------ */ private function _create_tabs($tabs,$count) { // Borrowed from Jermaine Maree, thanks mate! $titles = array( 'recent' => esc_html__('Recent Posts','blogside'), 'popular' => esc_html__('Popular Posts','blogside'), 'comments' => esc_html__('Recent Comments','blogside'), 'tags' => esc_html__('Tags','blogside') ); $icons = array( 'recent' => 'fa fa-clock-o', 'popular' => 'fa fa-star', 'comments' => 'fa fa-comments-o', 'tags' => 'fa fa-tags' ); $output = sprintf(''; return $output; } /* Widget /* ------------------------------------ */ public function widget($args, $instance) { extract( $args ); $defaults = $this -> blogside_get_defaults(); $instance = wp_parse_args( (array) $instance, $defaults ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $output = $before_widget."\n"; if($title) $output .= $before_title.$title.$after_title; ob_start(); /* Set tabs-nav order & output it /* ------------------------------------ */ $tabs = array(); $count = 0; $order = array( 'recent' => $instance['order_recent'], 'popular' => $instance['order_popular'], 'comments' => $instance['order_comments'], 'tags' => $instance['order_tags'] ); asort($order); foreach ( $order as $key => $value ) { if ( $instance[$key.'_enable'] ) { $tabs[] = $key; $count++; } } if ( $tabs && ($count > 1) ) { $output .= $this->_create_tabs($tabs,$count); } ?>
query('showposts='.absint($instance["recent_num"]).'&cat='.absint($instance["recent_cat_id"]).'&ignore_sticky_posts=1');?> array( 'post' ), 'showposts' => absint( $instance['popular_num'] ), 'cat' => absint( $instance['popular_cat_id'] ), 'ignore_sticky_posts' => true, 'orderby' => 'comment_count', 'order' => 'dsc', 'date_query' => array( array( 'after' => esc_attr( $instance['popular_time'] ), ), ), ) ); ?> absint( $instance["comments_num"] ),'status'=>'approve','post_status'=>'publish')); ?>
'', 'tabs_category' => 1, 'tabs_date' => 1, // Recent posts 'recent_enable' => 1, 'recent_thumbs' => 1, 'recent_cat_id' => '0', 'recent_num' => '5', // Popular posts 'popular_enable' => 1, 'popular_thumbs' => 1, 'popular_cat_id' => '0', 'popular_time' => '0', 'popular_num' => '5', // Recent comments 'comments_enable' => 1, 'comments_avatars' => 1, 'comments_num' => '5', // Tags 'tags_enable' => 1, // Order 'order_recent' => '1', 'order_popular' => '2', 'order_comments' => '3', 'order_tags' => '4', ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

" />

>

>

" name="get_field_name("recent_num") ); ?>" type="text" value="" size='3' />

$this->get_field_name("recent_cat_id"), 'selected' => $instance["recent_cat_id"], 'show_option_all' => esc_html__('All','blogside'), 'show_count' => true ) ); ?>


>

>

" name="get_field_name("popular_num") ); ?>" type="text" value="" size='3' />

$this->get_field_name("popular_cat_id"), 'selected' => $instance["popular_cat_id"], 'show_option_all' => esc_html__('All','blogside'), 'show_count' => true ) ); ?>


>

>

" name="get_field_name("comments_num") ); ?>" type="text" value="" size='3' />


>


" name="get_field_name("order_recent") ); ?>" value="" />

" name="get_field_name("order_popular") ); ?>" value="" />

" name="get_field_name("order_comments") ); ?>" value="" />

" name="get_field_name("order_tags") ); ?>" value="" />


>

>