Archived topic
Conditional based on layout
3 replies · Started by Mike on June 5, 2020
Hi - we're using our own tool (based on ACF) to do sidebars on a GP site.
We have a "sidebar selection" ACF block on pages - my question is, is there a way we can hide this if a user has selected "Content (no sidebars)" in the Page Builder Container part of the editor?
thanks
Mike
Hi there,
the Layout Metabox adds those options to the post meta - so you could use a condition to check if what it is set to like so:
if ( get_post_meta( get_the_ID(), '_generate_sidebar_layout', true ) === 'no-sidebar' ) {
// This happens when No Sidebar is selected in Layout Metabox
}
Hi David - excellent, thanks for this, will have a play!
Mike
You're welcome