Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to list most commented posts from last 24h/today, this week, this month, this year or all time? Or since X days ago.
- <?php
- $popular = new WP_Query( array(
- 'post_type' => array( 'post' ),
- 'showposts' => 6,
- 'cat' => 'culture',
- 'ignore_sticky_posts' => true,
- 'orderby' => 'comment_count date',
- 'date_query' => array(
- array(
- 'after' => array(
- 'year' => date( "Y" ),
- 'month' => date( "m" ),
- 'day' => "01",
- ),
- 'before' => array(
- 'year' => date( "Y" ),
- 'month' => date( "m", strtotime( "-1 Months" ) ),
- 'day' => date( "t", strtotime( "-1 Months" ) ),
- ),
- // 'inclusive' => true,
- 'month' => date( "m" ),
- ),
- ),
- ) );
- ?>
- <?php while ( $popular->have_posts() ): $popular->the_post(); ?>
- <?php the_title(); ?>
- <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement