Archived topic
How to hide element hook in archive subpages - page/2/, page/3/ & so on
3 replies · Started by Manish Jassal on May 26, 2019
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/
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 :)
It works. Thanks Leo for a great help.
No problem :)