Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

To make the container appear below the page navigation

  • Hi,
    I created a container (that starts with the text: YOU MY ALSO LIKE) at the bottom of a page, on preview, the content inside the container is appearing above the page navigation. I wanted to make it appear below the page navigation.
    Afterwards, I tried using the Block-Hook element. The content of the container did appear below the page navigation. However, there is an issue. The page is divided using a Page Break into 5 pages. The Block element is appearing after every page (Page 1-5), instead, of only appearing after the last page (Page 5). I have used after_content option in the Hook Name.

    What is the solution for both the cases?
    Thanks!

  • Hi there,

    Try this PHP filter, replace the 100 with your element id which can be found in the URL of the element editor:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
        global $wp_query;
        
        if ( 100 === $element_id && !( is_paged() && $wp_query->max_num_pages === get_query_var( 'paged' ) ) ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Let me know if this helps!

  • Hi,
    I added the PHP code using the Code Snippets plugin following this document (https://docs.generatepress.com/article/adding-php/).
    Then replaced the 100 with the element id 14541 present in the URL of the element editor.
    The code did not work.
    The block element disappeared from all the pages (Page 1-5).

  • Hi there,

    try this instead:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
    
        if ( 14541 === $element_id && is_paged() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );
  • Hi there,
    This does not work either.
    The block element is still appearing on all the pages (Page 1-5).

  • Can you double check the Element ID is correct ?

  • Upon editing the Element, I have mentioned the URL of the Element in the Private Information.
    Just to confirm, is the this Element ID 14541?

  • Yeah that is the ID.

    So lets give this a shot instead:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        if ( 14541 === $element_id && 1 != $paged ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );
  • Hi there,
    I tried it. It did not work.
    The block element is still appearing on all the pages (Page 1-5).

  • Can i get an Admin login to the site so i can take a closer look ?

  • Yes,
    I can provide Admin login using Temporary Login Without Password plugin.
    For this, can you provide me an email address to setup the temporary login?

  • Can you create an account with a fictional email / username. As we don’t need the email access options.

  • Oh Right.
    I didn’t know that.
    I have entered the Admin access link in the Private Information.

  • Hello Formanite,

    Can you try this snippet?:

    add_filter( 'generate_block_element_display', function( $display, $element_id ) {
        global $wp_query;
        
        if ( 14541 === $element_id && !( is_paged() && $wp_query->max_num_pages === get_query_var( 'paged' ) ) ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Let us know how it goes.

  • Hi there,
    It did not work. The block element disappeared from all the pages (Page 1-5).

  • The PHP method doesn’t work might because it’s not wp default pagination but added by a plugin.

    In that case, you might need to contact the plugin support for how to target the paged page.

    Or we can try a CSS solution, if you are ok with CSS, please activate the element for us to write the CSS.

    Let me know 🙂

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