FilWi
March 3, 2024, 3:32pm
1
I’ve got a query loop that pulls a custom post type. In that CPT, there is an image field, let’s call it acf_image.
What I want to do, is to create a slider that shows all posts that have an image, while skipping the posts which do not have it.
I’ve tried using the meta-query with the comparison set to exist and that gives me nothing (the entire slider disappears.)
I’ve tried using the empty string workaround (Query Loop + Meta Query Issue - #8 by aslotta ), but that gives me all the posts, including the ones without the image.
I’ve tries using the empty string workaround with a “not like” but that just kills the slider again.
I’ve tried setting the meta value to 0 and using greater than, but that gives me all the posts (the image is saved as an image ID, so it should be numerical.)
Any tips on what I should do?
TIA!
Hey @FilWi ,
I guess there is something wrong with your configuration. Just set up a quick demo and everything still works as expected. If you share your exact setup I’m happy to have a look.
Best,
André
1 Like
FilWi
March 6, 2024, 10:37am
3
Hey Andre,
big thanks, here it comes!
ACF setup:
Bricks structure:
Query loop top:
Meta Query 1 (works but includes empty images):
Meta Query 2 (works but includes empty images)
Meta Query 3 (works but includes empty images)
Meta Query 4 (doesn’t return any data, removes the entire slider from the page)
Anything you can think of would be highly appreciated!
TIA!
Hey @FilWi ,
you‘re showing a custom field called book_banner
but use cover_image
in your meta query. Is this the issue?
Best,
André
FilWi
March 6, 2024, 11:05am
5
4%#¤%!#¤!%%#¤!!!
I’m such an idiot…
Yes, that was the problem, huge thanks for spotting it! Now I’m going to go facepalm again
@FilWi I won’t tell anyone…