Hi,
I am trying to build a looper provider giving me all the posts that have a specific tag. Lets say “music”. Works perfectly using the Looper Provider Query Builder putting music in the taxonomies. But now I need to find the posts that have the tag (e.g. music) in an ACF field (e.g. requested_tag).
Putting {{dc:acf:post_field field=“requested_tag”}} in the taxonomy field of the Query Builder does not work.
I have been trying all kind of other ways to get this working, but nothing works. Am I missing something or do I have to use a different approach?
Thank you for any help you can give me,
Patrick
Hello Patrick,
Thanks for writing to us.
Do you have created the tag using the ACF or it is just a post-meta field? In case you want posts that have a specific meta field value, I would suggest you set the looper provider as a Query string.
Please have a look at this article to learn more about how to use query strings.
You may check this thread as well for reference.
If it doesn’t work for you, please share your details in a secure note. Please provide the following details
- WordPress Login URL
- Admin-level username and password
- Exact page URL
You can find the Secure Note button at the bottom of your posts
Thanks
I actually found how to do it before I saw your reply, but thanks anyway.
I was talking about a search in the meta, not an ACF field. The ACF field is the tag I am looking for. So here is what finally worked. A Looper Provider Query String:
order=DESC&tag={{dc:acf:post_field field=“show_posts_with_tag”}}
Now my next question is how to exclude the current post if it has that tag I am looking for.
I tried the following, but it did not work:
order=DESC&tag={{dc:acf:post_field field=“show_posts_with_tag”}}&post__not_in= {{dc:post:id}}
Any hint?
Hi Patrick,
The {{dc:post:id}} will give the current post id, irrespective of whether the tag is attached to it or not, and will exclude the current post from the Looper output. But you are trying to exclude the current post if it has that tag, which is not possible.
Thanks
Yep, that’s right, but it doesn’t matter as the current post will not show up if it does not have the tag anyway as the looper provider only gives the posts that have the tag.
The problem is that post__not_in= {{dc:post:id}} does not work. The current post is not excluded. I found out this morning that post__not_in expects an array. This allows to exclude multiple posts. But {{dc:post:id}} is not an array. Can you think of a work-around?
Hi Patrick,
You can get more details on the post__not_in in the following thread.
Hope it helps.
Thanks
Great. That worked. I don’t understand how we get from
‘post__not_in’ => array( ‘{{dc:post:id}}’ ) to the syntax
post__not_in%5B0%5D={{dc:post:id}} as the %5B0%5D translates to [0] if I get this right, but it worked, so I am happy.
Thanks a lot! I always appreciate your responsiveness.
Patrick
Hey Patrick,
You’re welcome!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.