Support » Fixing WordPress » Query post for a specific month

  • I am trying to modify the theme I am using and for some reason the following code doesn’t work, I don’t know why.

    <?php $qstr='showposts=5&monthnum=' . the_date('m')  .'&year=' . the_date('Y'); ?>
    $posts = query_posts($qstr);

    I expect it to give me 5 posts from month/year of the archive page I am on. But I only get the 5 newest posts.

    There probably is an easier way to do this, please tell me about it.

  • The topic ‘Query post for a specific month’ is closed to new replies.