[Resolved] Conditional based on layout

Home Forums Support Conditional based on layout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1315466
    Mike

    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

    #1315520
    David
    Staff
    Customer Support

    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
    
    }
    #1322328
    Mike

    Hi David – excellent, thanks for this, will have a play!

    Mike

    #1322355
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.