Site logo

[Support request] How to Disable Hero in Page2, Page 3

Home Forums Support [Support request] How to Disable Hero in Page2, Page 3

Home Forums Support How to Disable Hero in Page2, Page 3

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1895259
    Chaitanya

    Hi

    I am using GeneratePress Premium, GenerateBlocks, and WP Show Posts.

    To Display Front Page Hero Section (Featured Posts), I am using “Block – Page Hero”

    This is the site: https://vsbytes.com/

    Solved the problem of Pagination using this code:
    https://generatepress.com/forums/topic/magazine-grid-2/#post-1277319 using the code

    I don’t want to show Page Hero on Page 2,3,4… And I don’t want to use a separate page as the front page as the look cannot be achived.

    https://vsbytes.com/page/2/

    How to disable it on those pages. I want to show it only on the front page.

    or

    it will also be Good if the 2nd page displays the post 13, 14 in Hero followed by 15 to 25 in Archive.

    Since the First Page has 1,2 Post in Hero and 3 to 12 in the Archive section.

    #1895301
    Chaitanya

    After doing hours of research, I added the below code

    add_filter( ‘generate_block_element_display’, function( $display, $element_id ) {
    if ( 58 === $element_id && is_paged() ) {
    $display = false;
    }

    return $display;
    }, 10, 2 );

    And the Problem is solved.

    #1895681
    David
    Staff
    Customer Support

    Glad to hear you found the solution.
    As a note, we added a Global filter for All Elements display conditions.
    See here:

    https://docs.generatepress.com/?s=_element_display

    The generate_element_display can be used in place of any of the legacy element specific filters

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