• Resolved liton1980

    (@liton1980)


    I have designed a custom front page on that displays multiple posts with different designs. I have made it with a custom cod, but it shows duplicate posts for each design loop. Is there any php code that i place on the page to check the posts at first before placing them on the page and eliminate duplicated ones from being published on the page?

    Btw i know it slows down the speed of loading page, but it doesn’t matter for me at the moment. So please guide me with any code you can think of!

    • This topic was modified 1 year, 10 months ago by liton1980.
    • This topic was modified 1 year, 10 months ago by liton1980.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Is your front page using a classic custom template or a series of query loop blocks? Blocks only give you limited control over what is shown. A classic template allows much greater control.

    In a classic template, within each loop, collect an array of IDs for each post output. Then in subsequent queries, pass this array as the “post__not_in” query var to exclude posts already shown in the previous queries.

    • This reply was modified 1 year, 10 months ago by bcworkz. Reason: *previous* queries not subsequent
    Thread Starter liton1980

    (@liton1980)

    I am using a classic theme. thank you for your guides. I try to solve the issue and will update the post if needed.

    Moderator bcworkz

    (@bcworkz)

    I misspoke earlier: exclude posts shown in *previous* queries, not subsequent :/
    Hopefully you understood the intent despite my use of the wrong word.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Prevent duplicated posts on a single page’ is closed to new replies.