• Actually this is quite complicated and I can’t think how to describe it briefly.
    I discovered that urls like ?cat=1,2,3 will return all posts in categories 1,2 and 3. So I made a search page that allows users to search like this, in a number of specified categories. Then I added a piece of code in the loop that skips a post (using continue;) if it’s not in all of the selected categories (default is to show all posts in any of the selected categories). Great, it works, but, here’s the problem:
    Although I’m only displaying the right posts, the number of posts visible on one page is a bit random. When my piece of code skips an offending post, the loop continues unawares, and when it gets to the max posts in one pages, it stops and you get the ‘more posts’ link, even if the number of posts actually displayed is less than it should be, even 0!
    Is there any way I can make the loop ‘lose’ an offending post? Or change some variables, or something, anything, to fix this problem?

    I’m not sure this is entirely clear but I would be very grateful for any help! Thanks!

  • The topic ‘Skipping posts in the loop’ is closed to new replies.