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.

Different Footer per Page incl. Subpage

  • Hello Tom & Co.
    I have created 2 different footers in Elements, including display rules (footer 1 on the whole page except page X, footer 2 on page X) Works fine. But I want footer 2 to be displayed on all subpages of page X as well. How can I achieve this? Filter?
    I have already done something similar in a hook for showing different navigations:
    <?php if (wpdocs_is_tree(Site ID)): ?>
    <div>block 1</div>
    etc.
    Kinda like this ?
    Thanks for helping.
    Greetings

  • Thank you for the quick reply.
    That’s how it works, but now all subpages of page X are displayed with both footers (footer 1 and footer 2).
    Have I forgotten something?

  • You would use a second filter to unset the the other element.
    Just set the ID to the other element and set the $display = false;

    eg.

    
    add_filter( 'generate_element_display', function( $display, $element_id ) {
        global $post;
    
        if ( 1180 === $element_id && ( is_page() && $post->post_parent == '415' ) ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );
  • php isn’t my strength 😉
    Thank you very much.

  • Glad to be of help

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