Archived topic
Secondardy menu doubled up/sticky?
11 replies · Started by William on March 2, 2020
Hi there,
I see the primary menu can be sticky - can the secondary menu be sticky?
Also, is it possible to have the secondary menu located twice on the site?
Many thanks,
Will
Hi there,
1. Sticky Secondary Nav - try this CSS:
.secondary-navigation {
position: -webkit-sticky;
position: sticky;
top: 0;
}
You'll have to adjust your sticky sidebar position to compensate for the stick nav.
2. The menu can be added to a Widget Area - using the nav widget
Hello,
Thank you for this - perfect. Is there a way to have the same animations if I would like as with the primary sticky?
Also, for mobile, the menu, when closed, appears as 'Menu'. Is it possible to change this to 'Explore %category%'?
Many thanks,
Will
Hi there,
The same animations aren't available at the moment, unfortunately.
You can change the mobile menu label in Customize > Layout > Secondary Navigation.
Hi there,
Thanks for this - is there a way to make the mobile menu 'Explore %category%' where %category% is the category of the post the menu appears on?
Kind regards,
Will
Hi there,
You might be able to do this:
add_filter( 'option_generate_secondary_nav_settings', function( $settings ) {
$category = get_the_category();
if ( $category ) {
$settings['secondary_nav_mobile_label'] = 'Explore ' . $category[0]->cat_name;
}
return $settings;
} );
Hello,
Where abouts do I add this? I tried as Additional CSS on customize but that does not seem to work.
Kind regards,
Will
Its PHP - this article explains:
Hi there,
Thanks for this - I've added the code but nothing seems to have changed?
Kind regards,
Will
Hi there,
It looks like it's working. Maybe try clearing your browser cache?
I checked out a few single posts and the category name is showing.
Ah yes, you're right, sorry about that.
Thanks very much!
You're welcome :)