Site logo

Archived topic

Changing the sticky navigation logo for second logo

3 replies · Started by Drew on December 9, 2022

Viewing posts 1–4 of 4

I am using a header element to implement a separate logo for visitors that are logged in to my site. The main replacement logo works fine. However, I can't figure out how to change the sticky navigation logo for the logged-in visitors. Any help would be appreciated.

Hi there,

try this PHP Snippet:


add_filter( 'generate_sticky_navigation_logo_output', function($logo) {
    if ( ! is_user_logged_in() ) {
        return;
    }
    return sprintf(
        '<div class="sticky-navigation-logo">
            <a href="%1$s" title="%2$s" rel="home">
            <img src="your_logo_url" class="is-logo-image" alt="alt name" width="100" height="100" />
            </a>
        </div>',
        esc_url( apply_filters( 'generate_logo_href', home_url( '/' ) ) ),
        esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
    );
} );

You will need to update the src and other attributes in the img tag.

How to add PHP: https://docs.generatepress.com/article/adding-php/

Perfect. Thank you.

You're welcome

This archived topic is closed to new replies.