Archived topic
How to hook into if a post of page is using an element to conditionally show ACF
2 replies · Started by Brad on April 23, 2021
I'd like to have a condition option show up in ACF for deciding whether or not to show a field group on an editor dependent on if that post has been assigned as a condition for displaying a hooked GeneratePress Element.
Do you have a suggestion on how I might do this?
Hi there,
we introduced an Active Elements meta box in the Post Editor in GPP 2.0 - so it should be able to check for an active Element and filter the Field Groups display conditions.
I am going to pass this over to Tom as he may have an idea on how to do that.
Hi there,
Your screenshot doesn't seem to be working.
In GPP 2.0, we can check the active Elements on any given page (front-end or back-end) using a global variable:
global $generate_elements;
You can var_dump() the variable to see how it's set up so you can check specific aspects of each Element.
Let me know if you need more info :)