• Resolved Ziqurrat

    (@ziqurrat)


    Hi,

    I have multiple loop in widget in my homepage: one for posts with category A, one for posts with category B.

    In a third loop I would like to put mixed posts but it duplicates the same content of the first two loops. I don’t want to fully exclude categories A and B.
    Is there a way to collect the posts IDs from the other loops in the same page and exclude them from the query?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Andrew Misplon

    (@misplon)

    Hi @ziqurrat

    Thanks for reaching out.

    Unfortunately, we can’t think of any ways to accomplish this task from within any of our widgets.

    Sorry, wish we had better news. Manually excluding full categories or posts by ID’s is as much as we can offer from within the Post Loop widget or widget with a post loop query.

    Thread Starter Ziqurrat

    (@ziqurrat)

    Hi Andrew, thank you for the reply.
    This would be a nice feature to add to the plugin.

    In the meantime, I’d like to try a workaround.
    I’ve added to the functions.php a global var to store the post ids.
    I’ve got some custom templates for my loops, so I can save the IDS to exclude inside the global variable and then use it to filter the query by adding the parameter ‘post__not_in’.

    It works, somehow. But I know that global vars are not a best practice. Have you got any suggestion on how can I make it better?

    Plugin Support Andrew Misplon

    (@misplon)

    Thanks for this idea, it’s a good one for sure. I’ve made a note of it on our side. With regards to your workaround, unfortunately, we don’t have any better ideas at the moment.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Avoid duplicate post’ is closed to new replies.