Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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...

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.