Archived topic
Add custom body class IF an GP Element is rendered on page
2 replies · Started by Chris on February 16, 2020
This might be more of a feature request - but if there is a way to do this it would be great. I'd like to be able to style a page a little differently depending on a GP Element appearing.
I could start doing page templates, but thought if there were a field within the Element editor that allows custom classes to be targeted in the body tag it could open up the theme to some wild styling stuff!
Example: I have an Element named 'Testimonial' that appears across most pages except a dedicated Testimonial page. If I could add a custom class to the body of 'has-testimonial-element' then I could style *other* sections on the page - whether higher or lower in the rendered HTML - for some creative results.
I could do this via JS right now - but could be nice built in to the Settings panel where it has options to execute PHP and shortcodes
Hi there,
This has come up a few times now, I think it would be a useful addition to all three Element types.
I'll see about getting this in GPP 1.10.0 or 1.11.0 :)
oooohhh that'd be nice - thanks for the consideration!