[Resolved] How to hide element hook in archive subpages – page/2/, page/3/ & so on

Home Forums Support [Resolved] How to hide element hook in archive subpages – page/2/, page/3/ & so on

Home Forums Support How to hide element hook in archive subpages – page/2/, page/3/ & so on

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #911129
    Manish Jassal

    Hi,

    I create a hook for my shop page but i don’t want that hook for shop sub pages like; page/2/, page/3/ & so on. So, pls tell me how can I disable that hook in shop archive sub pages.

    This is my shop page where i add the hook: https://www.sharesnappy.com/shop/

    #911407
    Leo
    Staff
    Customer Support

    Hi there,

    Give this snippet a shot and replace 10 with the actual ID of the hook element:

    add_filter( 'generate_hook_element_display', function( $display, $element_id ) {
        if ( 10 === $element_id && is_paged() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Let me know ๐Ÿ™‚

    #911615
    Manish Jassal

    It works. Thanks Leo for a great help.

    #911622
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

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