Conditional display in cornerstone based on page body class?

Hi!
I’m creating some custom layouts using Cornerstone and I’d like to hide or display a certain area based on if a certain body class is present on the page.

I’m having a hard time wrapping my head around how to do that and can’t seem to find a clear answer as to if that’s possible.

Could you let me know if that’s a possible thing to do and if so, how to set it up in the conditions?

Thank you so much in advance for any help you can give me!

Hello @mdsone,

Thanks for writing to us.

Regretfully there is no option to hide content on the basis of the body class. It would require custom development, I would suggest you contact a developer who can assist you with your concern. Please note we don’t provide custom development support. it is out of the support scope.

If you want to hide any section you can use the Hide During Breakpoints.

Hope it helps
Thanks for understanding

Hmm - shoot :slight_smile:
Ok so the hide based on breakpoint won’t work as I’m trying to show or hide an element based on what the parent’s post type is.

I see in the conditions area there is an option for the URL - will I be able to use that to affect pages that have a specific url pattern to them?

For example I’m trying to show a banner on pages that have the path:
domain.com/programs/program-name/their-own-specific-slug-here

Can I target only pages that contain the /programs/program-name ?

Thanks so much for your help!

Hello @mdsone,

Having this URL: domain.com/programs/program-name/their-own-specific-slug-here could mean that the page is a child of Programs or that page is assigned to Programs category or it could also be that the custom post type is “Programs”. You can use the condition by using, “Parent”, “Ancestor”, “Post (has Term)” or “Post Type”.

Depending on your page structure, you should be able to use a condition to show or hide your element. Using the URL on the other is not possible.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.