- This topic has 7 replies, 4 voices, and was last updated 2 years, 8 months ago by
David.
-
AuthorPosts
-
April 3, 2023 at 7:42 am #2594663
Ben
Hi,
I’m using a sticky navigation, but the site title disappears as soon as it switches to sticky navigation. Can I make it part of the sticky navigation?
Thanks!
April 3, 2023 at 9:40 am #2594951Leo
StaffCustomer SupportHi there,
Any chance you can link us to the page in question?
You can use the private information field:
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-informationLet me know 🙂
May 16, 2023 at 12:40 am #2642310Ben
Hi,
thanks for your reply. Sorry, I had lost track of the topic – but still need help on the issue.What I want is .main-title to be part of the sticky navigation, so it stays visible with the navigation when scrolling down.
I am adding a link to the page mockup in the private info as suggested.Thank you!
May 16, 2023 at 1:37 am #2642378Fernando Customer Support
Hi Ben,
Try adding this Snippet:
add_filter( 'generate_sticky_navigation_logo_output', function( $output ) { $title = '<div class="sticky-navigation-title">Your Title Here</div>'; return $output . $title; } );Insert your title in the code.
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
May 16, 2023 at 2:53 am #2642457Ben
Thanks for the quick answer.
I’ve tried and see no change.I installed the Code Snippets plugin, added the snippet, told it to run everywhere, see here:
[Edit] I’ve tried to add an imgur-Link with a screenshot of my code snippet, seems not to work. Anyway, I’ve done as explained.
May 16, 2023 at 6:45 am #2642689David
StaffCustomer SupportHi there,
Fernandos code will only work if the sticky nav has a logo. Instead you can:
1. Add this PHP:
add_action('generate_inside_navigation', function(){ ?> <div class="sticky-brand site-branding"> <p class="main-title" itemprop="headline"> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a> </p> </div> <?php });It will return the site title you have in your Customizer.
2. Add this CSS:
.sticky-brand .main-title a { font-size: inherit; font-weight: inherit; } .sticky-brand { margin-right: auto; } .main-navigation:not(.is_stuck) .sticky-brand { display: none; }May 18, 2023 at 2:55 am #2645545Ben
Exactly what I wanted, works perfectly!
Thank you.
May 31, 2023 at 2:40 am #2694283David
StaffCustomer SupportGlad to be of help
-
AuthorPosts
- You must be logged in to reply to this topic.