• Resolved TheMadWiddler1200

    (@themadwiddler1200)


    Hello,

    Could this be possible? When you view your site normally you can see your tagline, and you can also see it on your sticky header. I’d like to change the tagline on the sticky header only, when you scroll down the page the sticky header appears and instead of showing your normal tagline it’s changed and now shows a different one? One that can be linked. Kind of like an extra menu item, but only visible on the sticky header.

    This would be very useful for some people. If there is a way to do this please let us know! ??

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,
    you can use a slightly different version of this

    add_filter( 'tc_tagline_display' , 'my_link_in_tagline');
    
    function my_link_in_tagline( $html ) {
        global $wp_current_filter;
    ?>
    <?php if ( !in_array( '__navbar' , $wp_current_filter ) ) :?>
        <div class="container outside">
            <h2 class="site-description">
             <a href="[PUT YOUR URL HERE]" title="[A TITLE]">My link</a>
            </h2>
        </div>
    <?php else:
            return $html; //when hooked on __navbar;
        endif;
    }

    hope this helps.

    Thread Starter TheMadWiddler1200

    (@themadwiddler1200)

    Hi d4z_c0nf, thanks for replying!

    I tried the code you provided but a link doesn’t appear in my sticky header tagline. Could you check my code below and see if I did something wrong. Should I remove these >> [ ] in the link?

    /* This code changes the tagline */
    add_filter( 'tc_tagline_display' , 'my_link_in_tagline');
    
    function my_link_in_tagline( $html ) {
        global $wp_current_filter;
    ?>
    <?php if ( !in_array( '__navbar' , $wp_current_filter ) ) :?>
        <div class="container outside">
            <h2 class="site-description">
             <a href="[https://www.google.com]" title="[Awesome title]">d4z_c0nf is awesome</a>
            </h2>
        </div>
    <?php else:
            return $html; //when hooked on __navbar;
        endif;
    }

    Thanks for helping, d4z! ??

    Nope, not your fault, it’s my fault!
    Don’t know why but I thought about the mobile tagline. Sorry ??
    replace the old wrong code with this (with [] already removed)

    add_filter( 'tc_tagline_display' , 'my_link_in_tagline');
    
    function my_link_in_tagline($html) {
        global $wp_current_filter;
    ?>
        <?php if ( in_array( '__navbar' , $wp_current_filter ) )  :?>
            <h2 class="site-description">
                 <span class="tagline"><?php bloginfo( 'description' ); ?></span>
                 <a class="sticky-tagline" href="https://www.google.com" title="Awesome Title">Yes d4z_c0nf is really awesome! :P</a>
            </h2>
    <?php else :
            return $html; //when hooked outside __navbar
          endif;
    }

    Then in your custom-css add this:

    .site-description .sticky-tagline {
        display: none;
    }
    .sticky-enabled .site-description .tagline {
        display: none;
    }
    .sticky-enabled .site-description .sticky-tagline {
        display: block;
    }

    Thread Starter TheMadWiddler1200

    (@themadwiddler1200)

    d4z_c0nf, you really are awesome!! Thank you very much for this! Is there a way to make this new link open in a new window? Thank you, d4z! ??

    adding target=_blank
    <a class="sticky-tagline" target="_blank" href="https://www.google.com" title="Awesome Title">Yes d4z_c0nf is really awesome! :P</a>
    You’re welcome.

    Thread Starter TheMadWiddler1200

    (@themadwiddler1200)

    Thank you very much, d4z!!

    :*

    Sorry to bump this… is there a way to do this before the update with sticky header options?

    EXAMPLE

    We have this in CSS:

    /* Make Header 'Sticky' */
    .tc-header {
    position:           fixed;
    top:                0px;
    background-color:   #fff;
    z-index:            101;
    width:              100%;
    max-height:         113px;
    }
    body {
    padding-top:        113px;
    }

    We want the tagline to disappear on scroll.

    Do you know a solution?

    Thank you

    Only sticky menu items.

    I tried:

    .navbar .nav > li > a { position: fixed; }

    but it makes them move…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Change tagline on sticky header?’ is closed to new replies.