1

I have WordPress set to display 5 posts per page, which is what I want. However, I'm now starting to use the new post formats (link, status, quote etc.) but I would these to not be counted towards the 5 posts per page. So how can I make the loop display the last x posts until it hits 5 standard posts?

1
  • Hi. Rigging one page to stop showing after 5 normal posts is relatively easy. Rigging the pagination to divide up all the posts after 5 normal posts is difficult. Can you confirm which it is that you want? Oct 11, 2011 at 18:57

1 Answer 1

1

As per comment trying to do this in one action will probably cause unholy pagination issues.

It might be easier to limit main query to normal posts, query posts with formats separately (depending on what you have in normal posts by date) and mix two sets together on display.

3
  • This is essentially what I was going to suggest: exclude the post-format Posts from the Primary Loop, so that they are excluded from Loop output and in the pagination. Then, query the post-format Posts using a secondary loop, and output them however appropriate. Oct 11, 2011 at 22:28
  • That would be perfect yes. I understand the exclude part for the main loop with the standard posts but I'm not sure how to set up the second loop and then mix it together to be displayed in chronological order. Any pointers would be most welcome.
    – Jos
    Oct 12, 2011 at 8:28
  • @Jos basic idea would be to retrieve two sets of posts as arrays, put those array together (sorted by date) and loop through resulting set. That is mostly a lot of PHP rather than WP functionality.
    – Rarst
    Oct 12, 2011 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.