I am trying to allow a user to sort the posts on the archive.php file by most commented or most recent. If I change the archive.php page to include this code based a querystring parameter, it doesn’t respect the month and year in the URL; it just displays all posts.
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
‘orderby’ => ‘comment_count’,
‘order’ => ‘DESC’,
‘paged’ => $paged
Is there a way for me to grab the month and year out of the URL so that I can display just the posts for that month and year? If so, I can add it to the arguments in the $args array.
PS — I am using the out of the box archive widget to get to the site.com/year/month page (which displays the archive.php from the site theme).
- The topic ‘Sort items in archive.php’ is closed to new replies.