• Can someone help with the following.

    I need to pull posts in three ways but collectively as one. this is what i mean

    The 15 most recent posts
    I need code to get
    1. the most recent posts (1)
    2. the most recent posts with feature images that is not in 1. (3)
    3. the next most recent post (4)

    so if i had 10 posts 1 being most recent
    1.
    2.
    3.with image
    4.
    5.With image
    6.With Image
    7.
    8.With Image
    9.
    10.

    The results returned for each point would be
    1. post 1
    2. post 3 post 5 and post 6
    3. post 2, post 4, post 7 and post 9

    Can anyone advise on how to achieve this

    thanks in advance
    Ilan

Viewing 1 replies (of 1 total)
  • You can reuse the query by using rewind_posts().

    Create 3 while loops, one for each type of post. Test for the type of post inside each loop.

    Use a counter to exit the loops when the correct number of posts is found.

    Save the IDs of the used posts in an array and do not display if a duplicate.

    rewind_posts() after each loop.

Viewing 1 replies (of 1 total)

The topic ‘Post coding help required’ is closed to new replies.