'widget_class', 'description' => __('Widget to display popular posts')); $control_ops = array('width' => 200, 'height' => 250); parent::WP_Widget(false, $name = __('AWP Popular Posts'), $widget_ops, $control_ops ); ?> __('Popular Posts'), 'post_count' => __('5'),'sort_radio'=>'0','featured-image'=>'0','post-date'=>'0','post-author'=>'0','post-category'=>'0','comments'=>'0','views'=>'0','post-excerpt'=>'0'); $instance = wp_parse_args( (array) $instance, $defaults ); if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; $post_count=$instance['post_count']; } else { $title =$defaults['title']; $post_count=$defaults['post_count']; }?>

value="views">Sort by Views
value="comments">Sort by Comments

id="get_field_id('featured-image'); ?>" name="get_field_name('featured-image'); ?>" />

id="get_field_id('post-date'); ?>" name="get_field_name('post-date'); ?>" />

id="get_field_id('post-author'); ?>" name="get_field_name('post-author'); ?>" />

id="get_field_id('post-category'); ?>" name="get_field_name('post-category'); ?>" />

id="get_field_id('comments'); ?>" name="get_field_name('comments'); ?>" />

id="get_field_id('views'); ?>" name="get_field_name('views'); ?>" />

id="get_field_id('post-excerpt'); ?>" name="get_field_name('post-excerpt'); ?>" />

$post_count, "post_type" => "post", "post_status" => "publish", "orderby" => "comment_count", "order" => "DESC" ); $asc_list = new WP_Query($args); if($asc_list->have_posts()) { echo "