[Support request] Display rules to target page options?

Home Forums Support [Support request] Display rules to target page options?

Home Forums Support Display rules to target page options?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2366529
    Carolyn

    I have a header element and layout being applied to all pages. But there are specific pages that I want to essentially be a full-width builder page (a blank slate) – so I don’t want the element applied there. In other builds, I have been able to disable the content title and have full width content container, but it seems like the only way to get a blank slate is to make an exception in display rules on the elements. I’d rather not do that every time I create a builder-style page. Is there a way around this? Like a way to use display rules to make an exception to everything with “full width” content container selected in the page options? Or a way to disable custom elements like the “disable elements” checkboxes in the page options?

    #2366988
    David
    Staff
    Customer Support

    Hi there,

    one method i use is the following PHP Snippet:

    // Generate custom taxonomy for Element Display Rules
    function element_control_custom_tax() {
        register_taxonomy(
            'element-controls',
            array( 'post', 'page' ),
            array(
                'label' => __( 'Element Controls' ),
                'rewrite' => array( 'slug' => 'element-controls' ),
                'hierarchical' => true,
                'show_in_rest' => true,
            )
        );
    }
    
    add_action( 'init', 'element_control_custom_tax' );
    
    // Exclude custom taxonomy from wp_sitemaps
    add_filter('wp_sitemaps_taxonomies', function( $taxonomies ) {
          unset( $taxonomies['element-controls'] );
          return $taxonomies;
      }
    );

    What it does is register a Custom Taxonomy called Element Controls for Posts and Pages.
    Its only visible on the backend.

    With it you can create your own custom Terms, eg. Full Width Pagebuilder layout
    And you can use the Element Control terms for your Element Display Rule Locations and Exclusions.

    Added bonus is that the Element Control admin view will allow you to see all terms and the posts / pages that are using them.

    #2370462
    Carolyn

    Very cool idea. Will try it out! Thanks.

    #2370875
    David
    Staff
    Customer Support

    You’re welcome 🙂 Let us know how you get on.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.