Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created October 27, 2013 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/7177412 to your computer and use it in GitHub Desktop.
Save Shelob9/7177412 to your computer and use it in GitHub Desktop.
Most commented WordPress posts in the last week. See: http://JoshPress.net/blog/using-new-date-queries-wordpress-3-7
<?php
$args = array(
'date_query' => array(
//set date ranges with strings!
'after' => '1 week ago',
'before' => 'today',
//allow exact matches to be returned
'inclusive' => true,
),
'orderby' => 'comment_count',
'order' => 'DESC',
'posts_per_page' => '5',
'paged' => '1',
);
$query = new WP_Query($args);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment