How to get filtered-by-category page to dispolay the proper number of posts? (2 posts)

  1. Carrie
    Posted 9 years ago #

    # posts (not days) to display is set to 20 in the WP UI. That works properly on the main blog page. (www.ponderethereal.com)

    I set up a sub-blog (www.ponderethereal.com/asperger) and I limited it to certain categories using in_category.

    It seems to be looking at the last 20 most recent posts and THEN displaying the ones that match the category criteria out of that 20. So I might get no posts that show up - or I might get 1 or 5... depending upon how many of the last 20 posts are in those categories.

    How do I get it to look for the categories FIRST and then display the correct number of posts?

  2. Carrie
    Posted 9 years ago #

    NM... answered my own question. I found it burried in http://codex.wordpress.org/The_Loop

    <?php $my_query = new WP_Query('category_name=featured&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>
    <!-- Do stuff... -->
    <?php endwhile; ?>

    Using the top level category gets all of the sub categories too.

Topic Closed

This topic has been closed to new replies.

About this Topic