• kandaba

    (@kandaba)


    I’m using the infinite scroll plugin and need to display ten posts on the home page at any one time.

    However…if a post is a particular post_format (eg. ‘quote’), I don’t want to display any more than one consecutively.

    So I might have (post listing):

    * Standard *
    * Standard *
    * Standard *
    * Quote *
    * Standard *

    But can’t have:

    * Standard *
    * Standard *
    * Quote *
    * Quote *
    * Standard *

    I can loop through on the home page and do this programatically, but that means that I have less than ten posts on each page (as I’ve taken out any consecutive posts).

    In some instances, this means that infinite scroll kicks in immediately, and sometimes only returns a post or two at a time.

    Is there a sensible way of doing this that will work with infinite scroll?

    TIA.

Viewing 1 replies (of 1 total)
  • luckdragon

    (@luckdragon)

    you could do a double query/double loop.. i.e.
    query for the quotes, then query for the standards

    while looping through the standards, add a counter, when the counter = 3, display a quote, reset the counter to 0 and continue with the standards..

Viewing 1 replies (of 1 total)

The topic ‘Grouping home posts by post_format’ is closed to new replies.