'category_posts', 'description' => 'Displays the post image and excerpt from a selected category **Does not work on singlepost sidebar**'.'bundler' ); /* Create the widget. */ parent::__construct( 'category_posts-widget', 'Bundler - Premium Popular Posts', $widget_ops, '' ); } function widget( $args, $instance ) { global $bundler_data; extract( $args ); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title'] ); // to sure the number of posts displayed isn't negative or more than 10 if ( !$number = (int) $instance['number'] ) $number = 5; else if ( $number < 1 ) $number = 1; else if ( $number > 10 ) $number = 10; //the query that will get post from a specific category. //Wr slug the category because you actualy need the slug and not the name $pc = new WP_Query("orderby=comment_count&showposts=".$number."&nopaging=0&post_status=publish&ignore_sticky_posts=1&post_type=post"); //display the posts title as a link if ($pc->have_posts()) : echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; ?> have_posts()) : $pc->the_post(); ?>
' ;?>

'Popular Posts', 'number' => 5); $instance = wp_parse_args( (array) $instance, $defaults ); ?>


(at most 10)