Thanks for sharing your insight. I did try echoing and it doesn’t return anything. As mentioned it returns NULL when I do a var dump.
I’ll try what you’ve said in the last paragraph, but to be honest the more time I spend on this, the more I’m thinking I’ll do this the other way around. Create all the filters now, and just use some conditional code in the template to call the correct filter on the correct category page. Not my ideal choice, but there’s only so many hours you can throw at something!
@hube2 thanks as always for your efforts. I’ve changed that, thank you.
The more I think about this, I wonder if this is AJAX-related. If I try loading a products category with no products in, I can get the value of the field to print. If I try with a category that has products in it, it won’t return anything. This makes me think if my ACF field is trying to load a YITH filter first before the YITH plugin does what it needs to do with checks using AJAX, therefore the filter doesn’t ‘exist’ at that point.
Would you know of anything I can do with ACF that can ‘listen’ for some AJAX to finish?
I’ve reworked this and removed the array for checking if it is marked as an archive, instead, I’ve included an if statement within the loop to check whether each repeater has archive sub_group marked true or false. This has helped me achieve the results I was after.
Makes more sense that way, though probably not as quick.
Waheyy! Thanks @hube2, that’s perfect! I didn’t even consider that
get_the_title would work.
Hey John, thanks again for the quick reply.
I have tried this again sadly it’s blank.
As you mentioned taxonomies, to confirm, this is a Relationship field, the relationship being between posts. So, in this instance, the Add New Location (a cpt) admin page shows a column, which shows how that Location CPT is assigned to a Client CPT. It’s been a long day so perhaps I’ve misunderstood ha, but we’re not using taxonomies in this instance.
The field will only take one value.
Sorry if that wasn’t clearer earlier, hopefully that extra bit of info might help this along.
Hi @hube2 thanks for the quick reply, most grateful.
Sadly, that just returns blank. My current code works with it set as ID, so I set that to Object and changed the code to what you have there. And that returns blank.
$term->name; makes complete sense but I don’t understand why that is returning blank.
Sorry to dig up an old post, but I can’t seem to get this to work with sub fields (through a repeater).
I know John suggested the field key on another thread but I’ve had no luck.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.