WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Question About Multiple Loop Conditional (5 posts)

  1. pufftenticle
    Member
    Posted 6 years ago #

    I am attempting to dictate the number of post excerpts seen on category templates. I'm reading the multiple loop page in the codex, but not really understanding what I'm doing wrong. I have found this example:

    // Get the last 10 posts in the special_cat category.
      <?php query_posts('category_name=special_cat&showposts=10'); ?>
    
      <?php while (have_posts()) : the_post(); ?>
        <!-- Do special_cat stuff... -->
      <?php endwhile;?>

    I used this for the 'special category':

    <?php query_posts('category_name=11&showposts=4'); ?>

    but that returns a white page (just in the content area, the sidebars are fine).

    I tried again using the rewind:

    <?php rewind_posts(); ?>

    still white page. help ?

  2. pufftenticle
    Member
    Posted 6 years ago #

    I gave up too soon.

    replaced with this:

    <?php query_posts('category_name=NAMEOFCATEGORY&showposts=4'); ?>

    and everything is great.

  3. pufftenticle
    Member
    Posted 6 years ago #

    spoke too soon ? again ?

    that php call above is pulling up the correct posts in the correct category and displaying them on the correct template. however, the movement to page 2 and 3 and beyond only brings up the same page. i'm using Lester Chan's WP-PageNavi2.20 plugin.

    any ideas ?

  4. moshu
    Member
    Posted 6 years ago #

    Using query_posts kills the next/prev navigation - most of the times. There was some additional code posted how to correct that... I just can't remember where.

    As another idea: why not use the CQS (custom query string) plugin to set the number of posts shown in different views?

  5. pufftenticle
    Member
    Posted 6 years ago #

    i didn't even think of that. i already had it installed. what an easy fix. thanks a bunch !

Topic Closed

This topic has been closed to new replies.

About this Topic