Archived topic
Remove elements using code
3 replies · Started by Mike on June 23, 2021
Hi
Apologies if this is easy / already documented!
Scenario is: I have an object custom post type, thus have a single-object.php to display that specific single.
But - I have another bit of the site where I want to show the same information as single-object but in a modal, and without various elements (header, navigation, footer).
Normally I'd just pass in a querystring, say single-object.php?display=modal or similar - and then use this to hide stuff on the site.
I can do this in my child theme - but is there a more cunning way using GP hooks / filters?
Thanks
Mike
Hi there,
if you had a Layout Element created to disable the theme elements you don't require - then you use this filter for setting the display rules:
https://docs.generatepress.com/article/generate_layout_element_display/
Hey David - thanks loads, this is really useful and exactly what I'm after.
cheers
Mike
Glad to be of help!