Meta Query ACF?

Hey guys

Is there a way to use the meta key with a post loop, to query say an ACF field to see if it’s 1 or 0 (true false) and only show the posts that way? I know you can make a custom wp query but wondered if that was needed as it’s relatively simple.

I know you can loop normally in Bricks Loop builder but not used it much to check for a ticked ACF box at the same time to check the posts against, let’s say.

In this instance, I want to show just one post on a homepage when a tick box is selected.

Many thanks

No way to achieve this using native Bricks functions?

Still nothing? I guess that’s a no then?

Nobody tried to do this?

Hi Rob,

Currently not in front of the PC so unable to do a screenshot for you.

Surely you can do it natively in Bricks by using Meta Query settings.

Meanwhile, you can do a search of ‘meta query’ in the forum and those threads should be able to help you.

Example: Metabox, Query Loop and Excluding according to a value in the custom field

Regards,
Jenn

1 Like

Cheers @itchycode that’s helpful for sure.

I think it’s largely confusion in the way it’s checking for the presence of the ACF within the actual post loop itself rather than afterward.

Reading about online I’m sure I’ve likely been 99% there, but knowing to tweak the Bricks shortcodes {}
to have things like :value in isn’t ideal when that could be the reason nothing is filtering perhaps.

Cheers

Sorry I’m late, but since no one actually answered it…

You don’t need to use a meta query at all to do this. You can do it with conditions.

Example:
I have a WooCommerce store that sells comic books. Each product has a “physical” and “digital” variation that have different prices. It’s hard to get the prices of variations to show up in queries, so I added custom fields to the products for “physical price” and “digital price” so I can duplicate the prices in the ACF fields.

In Bricks I have the card element I use for the comics in the shop. I set the query type to ‘Posts’ and the post type to ‘Products’. Now all my products show up in the grid.

On the same element that has the query loop, I open up the conditions. In the first box select ‘Dynamic Data’. In the second box I search for the ACF field that I want, in my case it was {acf_variation_info_physical_price}. Then I set the third box to ‘!=’ (does not equal) then in the fourth box I put ‘10’. Now all the comics with a physical price of 10 have disappeared from the grid (and the Dom).

Also Kevin Geary did a tutorial on how to use a radio button on a post from ACF or Metabox to turn on/off a promotional banner by using data attribute populated with dynamic data from the radio buttons and then using conditions to show/hide elements based on those attributes.