Site logo

Archived topic

Generate Page Hero inside Content Area

5 replies · Started by Michael on June 5, 2019

Viewing posts 1–6 of 6

I'm setting a site up using Dispatch from the site library and am keen to move the Page Hero on blog posts into the content (rather than have them full width).

I tried using the following code:

add_filter( 'generate_page_hero_location', function() {
	return 'generate_before_content';
} );

But this then breaks the Magazine grid on the front page.

How can I only apply it to this specific Header element?

Hi there,

Give this a shot:

add_filter( 'generate_page_hero_location', function() {
    if ( 10 === $element_id )  {
        return 'generate_before_content';
    }
     return 'generate_after_header';
} );

Make sure to change 10 to the actual ID of the header element.

Thanks Leo.

I added it but it seemed to stop all the headers appearing

I've tried the same. In my case, with the code above, $element_id seems not to be defined.
After some browsing I got the code below to work.

add_filter( 'generate_page_hero_location', function( $display, $element_id ) {
    if ( 10 === $element_id )  {
        return 'generate_before_content';
    }
     return 'generate_after_header';
}, 10, 2 );

Glad to hear :)

This archived topic is closed to new replies.