Forums

stop query_posts (3 posts)

  1. fksr86
    Member
    Posted 4 years ago #

    hey everyone

    i want something that i don't know much how to explain, but here we go.

    i'm using a $counter variable, defined before the loop:

    <?php $counter = 0; ?>

    everypost adds 1 to the counter:

    <?php $counter = $counter + 1; ?>

    but, if the post is in category 6, it adds one more:

    <?php if (in_category('6')) { ?>
    <?php $counter = $counter + 1; ?>

    well, i do it because i want that when it reaches 7, it shows up a page:

    <?php if(7 == $counter ) : include (TEMPLATEPATH . '/BREAKING-NEWS.php'); endif; ?>

    here is my question: i want to stop query_posts after counter reaches 10, but i can't do it by myself. do you guys suggest something?

    thanks!

  2. fksr86
    Member
    Posted 4 years ago #

    :(

  3. iridiax
    Member
    Posted 4 years ago #

    Do you mean ending the loop with an endwhile; after $counter equals 10?

    http://codex.wordpress.org/The_Loop

Topic Closed

This topic has been closed to new replies.

About this Topic