[Resolved] Hero element display rule

Home Forums Support [Resolved] Hero element display rule

Home Forums Support Hero element display rule

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1560945
    Colas

    Hi,

    I’m trying to disable the “global hero page header” in order to create a custom one on a custom template page.
    I tried to do that by adding a filter inside functions.php like that :

    add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
    	if ( 68 === $element_id && is_page_template('template_top_img.php')) {
    		$display = false;
    	}
    	return $display;
    }, 10, 2 );

    where 68 is the ID of the “global hero page header” element, and template_top_img my custom template page. But it changes nothing.

    What’s wrong?
    THanks for your support

    #1561694
    Leo
    Staff
    Customer Support

    Hi there,

    Can you first confirm that the Exclusion under Display Rules doesn’t work for you?

    As for the filter, if you are referring to a header element, then try replcing generate_hook_element_display with generate_header_element_display.

    #1563330
    Colas

    HI,
    Thanks! It worked, I’m now able to setup a different hero automatically on my custom template.

    And yes, the Exclusion rule doesn’t allow to exclude per page template (and neither the location rules). It would make sense to add such a rule.

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