[Support request] Change Logo media source file when sticky

Home Forums Support [Support request] Change Logo media source file when sticky

Home Forums Support Change Logo media source file when sticky

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #304230
    Marie Odile

    Hi,
    I was wondering if it’s possible to change the image source file for the sticky menu. It looks by default it’s always the same image for the logo on the main navigation and on the sticky navigation.
    Thanks,
    Jesus

    GeneratePress 1.3.46
    GP Premium 1.2.96
    #304296
    Tom
    Lead Developer
    Lead Developer

    The navigation logo/sticky navigation logo are the same image I’m afraid.

    I’ll definitely put some thought into this though, might be able to come up with something ๐Ÿ™‚

    #304349
    Marie Odile

    Thanks!
    IF you have any idea on how to achieve it via hooks or similar let me know.
    Jesus

    #304545
    Tom
    Lead Developer
    Lead Developer

    You could do something using hooks..

    add_action( 'generate_inside_navigation','tu_navigation_logos' );
    function tu_navigation_logos() {
    ?>
        <div class="sticky-logo navigation-logo">
            <img src="URL TO NAVIGATION LOGO" alt="" />
        </div>
        <div class="sticky-logo navigation-logo sticky-only">
            <img src="URL TO STICKY NAVIGATION LOGO" alt="" />
        </div>
    <?php
    }

    Then some CSS:

    .navigation-logo.sticky-only {
        display: none;
    }
    
    .navigation-stick .navigation-logo.sticky-only {
        display: block;
    }
    
    .navigation-stick .navigation-logo:not(.sticky-only) {
        display: none;
    }

    Something like that should work.

    #508371
    mike

    Hello guys,

    How can i use this on the homepage only?

    Thanks

    #508494
    Leo
    Staff
    Customer Support

    Is your home page a static home page or a blog page?

    #508580
    mike

    Static

    #508802
    Leo
    Staff
    Customer Support

    Try this for the snippet:

    add_action( 'generate_inside_navigation','tu_navigation_logos' );
    function tu_navigation_logos() {
    ?>
        <?php if ( is_home() ) : ?>
            <div class="sticky-logo navigation-logo">
                <img src="URL TO NAVIGATION LOGO" alt="" />
            </div>
            <div class="sticky-logo navigation-logo sticky-only">
                <img src="URL TO STICKY NAVIGATION LOGO" alt="" />
            </div>
        <?php endif; ?>
    <?php
    }
    #509062
    mike

    Hey,

    The regular snippet works fine, this made the logo disappear

    any idea?

    i did leave ‘add_action( ‘generate_inside_navigation’,’tu_navigation_logos’ );’ and still nothing

    Thanks

    #509244
    Leo
    Staff
    Customer Support

    Try this CSS to go with the snippet instead:

    .home .navigation-logo.sticky-only {
        display: none;
    }
    
    .home .navigation-stick .navigation-logo.sticky-only {
        display: block;
    }
    
    .home .navigation-stick .navigation-logo:not(.sticky-only) {
        display: none;
    }
    #552494
    celito

    Hi Tom, we had a slight makeover, one of which was redesigning the logo. I can’t make it to show in the sticky menu. Instead the previous logo is still showing in the sticky menu, even if this has been deleted from the media library. If I remember right, wasn’t there a facility in the customizer before to change the sticky logo? I tried following the suggestion in your reply of April 11, 2017 to Marie, above, but wasn’t able to make it work. Any help will be greatly appreciated. Thanks.

    Celito

    #552854
    Leo
    Staff
    Customer Support

    Hi Celito,

    That sounds like a caching problem to me.

    Any chance you can open a new topic and link us to your site?

    Thanks!

    #553660
    celito

    I’ll check the cache first, and open a new topic if it does not work. Thanks.

    Celito

    #553698
    celito

    Hi Leo, just for my curiosity to what file should I add the hooks described? Maybe this is where I went wrong.

    Celito

    #553890
    Leo
    Staff
    Customer Support

    One of these method: https://docs.generatepress.com/article/adding-php/

    Again please open a new topic for further assistance ๐Ÿ™‚ Thanks!

Viewing 15 posts - 1 through 15 (of 19 total)
  • The topic ‘Change Logo media source file when sticky’ is closed to new replies.