Use Metabox field as condition in query loop

Hi,

I was wondering what I am doing wrong. I am trying to set a condition to the query loop that if it a Metabox field on the CPT page is set to the value of 1 (or the output ‘Ja’, either one will do fine) it should show it inside the slider. However, for some reason I am not able to get it to work. I have set the conditions as so: https://i.imgur.com/3vbyfOG.png. When I change the compare to numeric and the meta value to 1, which is the value inside the Metabox field, it also does not work. This is how I set up the metabox field: https://i.imgur.com/e9BD6GA.png. What am I missing?

Hey Brian,

this is how Meta Box stores your field setup in the database:

So this meta query should work:

I created a small screencast to demonstrate.

Best,

André

That is exactly what I am looking for, but it is not working on my end. The only difference we have is that you are using it on the archive page, while I am using it in a template element that appears on different normal pages. However, that should not make a difference right?

Hey Brian,

it’s a regular page in my case, not an archive. If you can share some temporary credentials to your site with me I’m happy to have a look.

Best,

André

Hi Aslotta,

I also have had contact with the support via the mail, since there is some time pressure behind this problem. They already have a login url, so I think it would otherwise get confusing?

Hi Brian,

Replied you via email.
Your field group has prefix ID.
So it should be b_e_show_comp_off for your case.

Regards,
Jenn

1 Like