'widget-beginner-tabs widget_tabs posts-thumbnail-widget', 'description' => __( 'Display popular posts, recent posts, recent comments and tags in tabs.', 'beginner' ) ); // Create the widget. parent::__construct( 'beginner-tabs', // $this->id_base __( '» Tabs', 'beginner' ), // $this->name $widget_options // $this->widget_options ); } /** * Outputs the widget based on the arguments input through the widget controls. * * @since 1.0.0 */ function widget( $args, $instance ) { extract( $args ); // Output the theme's $before_widget wrapper. echo $before_widget; ?>
$instance['comments_num'], 'status' => 'approve', 'post_status' => 'publish' ) ); ?>
5, 'recent_num' => 5, 'comments_num' => 5 ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

$number, 'orderby' => 'comment_count', 'post_type' => 'post' ); // The post query $popular = new WP_Query( $args ); global $post; if ( $popular->have_posts() ) { $html = ''; } // Reset the query. wp_reset_postdata(); if ( isset( $html ) ) { return $html; } } /** * Recent Posts * * @since 1.0.0 */ function beginner_latest_posts( $number = 5 ) { // Posts query arguments. $args = array( 'posts_per_page' => $number, 'post_type' => 'post', ); // The post query $recent = new WP_Query( $args ); global $post; if ( $recent->have_posts() ) { $html = ''; } // Reset the query. wp_reset_postdata(); if ( isset( $html ) ) { return $html; } }