Exclude current post in slide if on that current post

I have built a looper within a looper and am trying to hide the current post in the slider. Have tried several different ways mainly using WP query string with no luck. I am sure it is related to the fact that I have 2 different loopers running. Please see secure note.
Thanks

Hi @wowflak,

Thanks for reaching out.
I would suggest you go through the following thread on a similar topic, which may help you.



Hope it helps.
Thanks

Thanks, I have looked at all those and understand how they work. However my situation is a bit different. I have a post which is a Record Album and that is in a Toolset relationship with the CPT Artist. This all works fine. Now what I want to do is list other albums by the same artist below the currently viewed album. I achieve that by creating a looper inside of a looper.

First looks like this:
post_type=artist&posts_per_page=-1&toolset_relationships%5B0%5D%5Brole%5D=parent&toolset_relationships%5B0%5D%5Brelated_to%5D={{dc:post:id}}&toolset_relationships%5B0%5D%5Brelationship%5D%5B0%5D=artist&toolset_relationships%5B0%5D%5Brelationship%5D%5B1%5D=concord-albums

That pulls the artist that is related to the currently viewed album.

Then I add this second looper inside that:
post_type=concord-albums&posts_per_page=-1&toolset_relationships%5B0%5D%5Brole%5D=child&toolset_relationships%5B0%5D%5Brelated_to%5D={{dc:post:id}}&toolset_relationships%5B0%5D%5Brelationship%5D%5B0%5D=artist&toolset_relationships%5B0%5D%5Brelationship%5D%5B1%5D=concord-albums

This pulls the related albums and that is great. Now however I want to exclude the current album being viewed from the related albums collection. I cannot figure out how to do that because if I add the “not in” code to end of second loop it does not know what the currently viewed post is. It is looking at the parent “artist” post. And I cannot add the “not in” code to first looper because it is pulling the parent out of the post to setup the second looper.

Does this make sense?

Hi @wowflak,

Do you want to exclude the current post from the 2nd Looper Provider? In that case, you need to create a custom Looper Provider. I would suggest you go through the following article on how to use the Custom Looper and then check the following thread which may help you on this.


Thanks

Yes, exactly I want to exclude the current post from the second looper. I apologize my php skills are not great. Can you help expand how I can make this work with the custom solution?

Thanks

Hi @wowflak,

In that case, I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.