Site logo

[Resolved] Changing the sticky navigation logo for second logo

Home Forums Support [Resolved] Changing the sticky navigation logo for second logo

Home Forums Support Changing the sticky navigation logo for second logo

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2456659
    Drew

    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.

    #2456847
    David
    Staff
    Customer Support

    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/

    #2457215
    Drew

    Perfect. Thank you.

    #2457694
    David
    Staff
    Customer Support

    You’re welcome

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