[Resolved] Display Rule for a specific page template

Home Forums Support [Resolved] Display Rule for a specific page template

Home Forums Support Display Rule for a specific page template

Viewing 5 posts - 16 through 20 (of 20 total)
  • Author
    Posts
  • #936660
    Jonathan

    Ran into an issue to-day in that I have the hooks display working well but now the layout display is failing to stop featured images and titles from showing. I have a layout display set for all pages and ticked the title/featured img in the disable elements but if I create a new page they both show.

    Thought disabling the two elements in the page view as well but that didn’t work either. Here’s the code I am using to display the hook displays in my functions.php

    //GPRESS --------
    
    // Element_id is the element created in display rules
    
    add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
        if ( 60189 === $element_id ) {
            if ( is_page_template( 'my-templates/about.php' ) ) {
                $display = true;
            }
        }
    // Operational Efficiency
        if ( 59978 === $element_id ) { 
            if ( is_page_template( 'my-templates/operational.php' ) ) {
                $display = true;
            }
        }
    
    // Brand Awareness
        if ( 60023 === $element_id ) {
            if ( is_page_template( 'my-templates/brand.php' ) ) {
                $display = true;
            }
        }
    
    // Exit Strategy
        if ( 60031 === $element_id ) {
            if ( is_page_template( 'my-templates/exit.php' ) ) {
                $display = true;
            }
        }
    
    // Services Pages 
    
        if ( 60340 === $element_id ) {
            if ( is_page_template( 'my-templates/services.php' ) ) {
                $display = true;
            }
        }
    
        return $display;
    }, 10, 2 );
    

    I have the hooks setup in the wordpress admin but not set them to display on anything. Could this be the reason the layout display is failing?

    #936663
    Jonathan

    Just tried setting the hooks to a dummy page // editing out the code from the functions.php and the featured img/title are still showing.

    #937148
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    So you have a Layout Element created and it’s set to disable those elements, but it’s not working?

    Do you have any other Layout Elements that would apply to the same pages? Can you try disabling the other ones to see if there’s a conflict somewhere?

    Let me know ๐Ÿ™‚

    #939271
    Jonathan

    Hello,

    I worked out another template was overriding the layout option. Disabling that caused the layout element to work.

    thanks

    Jonathan

    #939704
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad you got it working ๐Ÿ™‚

Viewing 5 posts - 16 through 20 (of 20 total)
  • You must be logged in to reply to this topic.