[Resolved] Element/Hook

Home Forums Support [Resolved] Element/Hook

Home Forums Support Element/Hook

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1012201

    Hi Tom,

    I’ve added some Text as Element/Hook on my Frontpage. Right now I saw it is also displayed on /Page/2/, /page/3/ etc. – so it’s duplicate Content to my bad. Any idea how I can restrict it to be shown only on the Frontpage and exclude /page/x/?

    It’s display rule is “frontpage”, I have no useable exclude found.


    Customer Support

    Hi there,

    you can use this filter to remove the element from paged content:

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

    Replace the 10 with the ID of the Element you wish to remove. ID can be found by editing element and checking the URL.


    Hi David,

    thanks a lot, it’s working. But 1 question: at the end “}, 10, 2 );” – is the 10 also the ID? what is the 2? And how I can add 2 IDs at the same time, because I want to hide 2 elements.

    Thanks in advance

    Customer Support

    The 10 is the Hooks Priority – and you should leave this as 10.
    The 2 is the number of parameters used in the Filter. Again this should be left as 2.

    Just make a duplicate of the same code for your second element and change the ID.



    Customer Support

    You’re welcome

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