[Support request] Generate Page Hero inside Content Area

Home Forums Support Generate Page Hero inside Content Area

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #920715
    Michael

    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?

    #920833
    Leo
    Staff
    Customer Support

    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.

    #921135
    Michael

    Thanks Leo.

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

    #921148
    Leo
    Staff
    Customer Support

    Can you try the updated code?
    https://generatepress.com/forums/topic/generate-page-hero-inside-content-area/#post-920833

    And make sure you change the ID of the element.

    Let me know πŸ™‚

    #1313520
    John

    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 );
    #1314467
    Leo
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.