- This topic has 11 replies, 3 voices, and was last updated 4 years ago by David.
-
AuthorPosts
-
April 1, 2020 at 4:42 am #1221948t29k75
Hi guys,
I would like to set up fixed “navigation as a header” on all pages/posts (while not using sticky navigation), except home page.
my site: surf-atlantic
thanks,
Tibor
April 1, 2020 at 7:16 am #1222082DavidStaffCustomer SupportHi there,
you can use this filter to set the menu options for specific pages:
https://docs.generatepress.com/article/option_generate_menu_plus_settings/
For example this will enable Sticky Nav on Desktop and Mobile for all of the site apart from the Home Page:
add_filter( 'option_generate_menu_plus_settings','lh_custom_homepage_menu_plus_settings' ); function lh_custom_homepage_menu_plus_settings( $options ) { if ( !is_front_page() ) { $options['sticky_menu'] = 'true'; } return $options; }
April 1, 2020 at 8:24 am #1222300t29k75Hi David,
thanks for your reply.
I didn’t explain it correctly;)
Anyway, did some digging and applied Tom’s solution (#31579). Is it still “best” way to do it, considering it was from 2014?All looks good now except 2 pages blog page and reviews page
How/what can I adjust/change to get it right?
…and any chance to apply “new fixed header” on homepage as well, but that it will only appear when scrolling, after hero image disappear?
hope it makes sense,
Tibor
April 1, 2020 at 9:25 am #1222356DavidStaffCustomer SupportWhat was wrong with using the Sticky Navigation function ?
That method is still perfectly valid – the issue you have is the closing
</div>
in theafter_header
needs a lower priority number set, so it comes before the Header Element. Try changing the priority to8
Fixing the header to appear after the page hero scrolls off screen would require some Javascript – and i am not sure of the best method for this
April 1, 2020 at 9:58 am #1222418t29k75nothing wrong with sticky nav, like the look of fixed header more…
I set priority to 8 -> looks better. Just need to add top-padding to both pages (reviews header and blog header) and centre posts on blog page (left & right padding not equal now). Any idea?
thanksApril 2, 2020 at 2:10 am #1223089DavidStaffCustomer SupportMaybe simpler to add
margin-top
instead ofpadding-top
in your fixed header CSS this will push the element down as opposed to increasing the height of the element after it.This CSS is causing the issue with the Blog articles not being centred:
@media (min-width: 1024px) { .container { margin:20px } }
You may want to target the
.page .container
so it doesn’t break the archives or the single posts.April 2, 2020 at 10:11 am #1223872t29k75Hi David,
your margin suggestion worked great!
To make things simple, I deleted all media queries/margins for container and all looks good.Last question: how can I add shadow at the bottom of header/nav up to 1023px? It is there from 1024px and higher. I think bellow css is responsible for that…
#masthead {
-webkit-box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25);
-moz-box-shadow: 0 2px 4px -1px rgba(0,0,0,0.25);
box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.25);
}thanks for your patience:)
April 2, 2020 at 4:46 pm #1224239TomLead DeveloperLead DeveloperHi there,
I’m seeing that CSS applied at all screen sizes at the moment. Are you seeing something different on large sizes vs smaller? If so, can you share a screenshot?
Thanks!
April 2, 2020 at 9:25 pm #1224376t29k75Hi Tom,
please see screenshots. I checked my mobile & ipad as well. No shadow up to 1024px.
thankshttps://i.paste.pics/8IYOT.png
https://i.paste.pics/8IYP3.pngApril 3, 2020 at 4:53 am #1224698DavidStaffCustomer SupportYou have the Mobile Header enabled. So you must include #mobile-header in your CSS e.g
#masthead, #mobile-header {
April 3, 2020 at 9:05 am #1225210t29k75David, Tom, you are legends.
…now if I can somehow find a way to show menu on home page. my next task/head scratcher 😉
Thanks a million!
April 3, 2020 at 1:19 pm #1225542DavidStaffCustomer SupportGlad we could be of help
-
AuthorPosts
- You must be logged in to reply to this topic.