Archived topic
Site title disappears on sticky header-navigation
11 replies · Started by Miro on April 28, 2019
Hello!
In my header, I have a logo, site title, tagline and menu.
When I scroll down and the sticky header appears, site title and tagline don't show.
I have found a couple of similar posts in this forum but haven't been able to successfully implement the hooks which were advised to be used as a solution of the issue.
The weirdest thing is that the title and tagline showed alright a few days ago.
Logic dictates I must have messed something up but I am not at all aware of what it might be.
Would be grateful for any assistance.
Thank you.
Miro
Hi Miro,
The site title and tagline don't show in the sticky navigation by default.
The site title can display in the sticky navigation if you set your navigation as your header: https://docs.generatepress.com/article/navigation-as-a-header/
Otherwise, we can use hooks to add them into the sticky nav if you'd like.
Let me know :)
Hello Tom,
thanks for a quick reply. I tried setting the navigation as header but didn't like the look of the outcome. Tagline disappeared and the whole header got more narrow even before scrolling.
I would like to have the header as it is now. Then, when it sticks after scrolling, I would like to have the site title displayed (not the tagline). Could you, please, give me a hand with creating the hook you mentioned?
Definitely! Any chance you can remove the coming soon page so I can make sure the HTML/CSS I give you will work first try?
Let me know :)
Of course. Done.
Let's try this function:
add_filter( 'generate_sticky_navigation_logo_output', function( $output ) {
$title = '<div class="sticky-navigation-title">Your Title Here</div>';
return $output . $title;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/
Let me know :)
Thanks Tom, the function works like a charm!
And by the way, thank you for the best wp theme ever. ;-)
Have a great day.
Miro
Awesome! Thank you for using it!
You too :)
Hi Tom, I am trying this snippet on this site and having no luck. Any thoughts? subliminaryartworks.com
I am using Code Snippets as per suggestion. Thanks much, Dave
Any chance you can open a new topic for your question?
This one is a bit old.
Thanks!
Done.
Thanks :)