Popular Post By Month in WordPress
I have been trying to get popular posts for the current month. I wrote the code given here. But showing nothing.
?php
$query_args =
array(
'posts_per_page' = 3,
'post_type' = 'post',
'date_query' = array(
array(
'year' = date( 'Y' ),
'month' = date( 'm' ),
),
),
'meta_key' = 'wpb_post_views_count',
'orderby' = 'meta_value_num',
'order' = 'DESC',
);
$the_query = new WP_Query( $query_args );
?
?php
if ( $the_query-have_posts() ) :
while ( $the_query-have_posts() ) : $the_query-the_post();
?
div class="col-lg-4 col-md-4 col-sm-4 col-xs-12"
div class="post-item"
a class="post-thumb" href="?php echo get_the_permalink(); ?" title="?php the_title(); ?"
?php echo get_the_post_thumbnail();?
/a
h3
a href="?php the_permalink(); ?" title="?php the_title(); ?"?php the_title(); ?/a
/h3
/div
/div
?php endwhile; endif; ?
Topic popular-posts Wordpress
Category Web