query custom post type and order by most comments within one week
-
Hi I’m having a lot of trouble with my custom query… I had it working just fine, displaying all posts of a custom post type and ordering them by most comments within a single week. But since I installed the plugin “Newsletter”, it is no longer working, it doesn’t display ANY posts… Here is the code that was working before:
/* QUERY */ $week = date('W'); $year = date('Y'); query_posts('post_type=articles&posts_per_page=$number_posts&orderby=comment_count&ignore_sticky_posts=1&meta_key=_thumbnail_id&order=DESC&year=' . $year . '&w=' . $week); /* LOOP */ ...
I think one of the variables may be interfering with the Newsletter plugin somehow, because when I change the query back to this it works just fine (though only shows the most commented posts of all time):
/* QUERY */ query_posts(array('post_type' => 'articles', 'posts_per_page' => $number_posts, 'orderby' => 'comment_count', 'ignore_sticky_posts'=>1, 'meta_key'=>'_thumbnail_id')); /* LOOP */
What should I try next? Is there a better way to do this, a way that won’t conflict with anything else? I have seen a few other methods for displaying posts by most comments within a single week, but I don’t understand how to implement them.
Please help! This is the last thing I need to finish and then I’m done with my site. Thanks in advance…
- The topic ‘query custom post type and order by most comments within one week’ is closed to new replies.