'tabbed-widget widget_popular_stories',
'description' => esc_html__( 'Widget to display popular news, recent posts and comments in tab.', 'pt-magazine' ),
);
parent::__construct( 'pt-magazine-tabbed-content', esc_html__( 'PT: Tabbed Content', 'pt-magazine' ), $opts );
}
function widget( $args, $instance ) {
$popular_number = ! empty( $instance['popular_number'] ) ? $instance['popular_number'] : 5;
$recent_number = ! empty( $instance['recent_number'] ) ? $instance['recent_number'] : 5;
$commented_number = ! empty( $instance['commented_number'] ) ? $instance['commented_number'] : 5;
echo $args['before_widget']; ?>
absint( $popular_number ),
'no_found_rows' => true,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true,
'post_status' => 'publish',
'orderby' => 'comment_count',
'order' => 'desc',
);
$popular_posts = new WP_Query( $popular_args );
if ( $popular_posts->have_posts() ) :
while ( $popular_posts->have_posts() ) :
$popular_posts->the_post(); ?>
absint( $recent_number ),
'no_found_rows' => true,
'post__not_in' => get_option( 'sticky_posts' ),
'ignore_sticky_posts' => true,
'post_status' => 'publish',
);
$recent_posts = new WP_Query( $recent_args );
if ( $recent_posts->have_posts() ) :
while ( $recent_posts->have_posts() ) :
$recent_posts->the_post(); ?>
5,
'recent_number' => 5,
'commented_number' => 5,
) );
?>