- This topic has 8 replies, 2 voices, and was last updated 3 years, 11 months ago by
Tom.
-
AuthorPosts
-
January 1, 2019 at 7:18 am #770459
Peter
I have found a web site with an interesting layout that I would like to create with GeneratePress.
1. DESKTOP
The desktop layout comes with– Top Bar with background-color
– Header with logo
– Primary navigationThat is straightforward with GP, but here comes my question:
2. ON MOBILE
Would it possible to switch this around on mobile only to
– Primary navigation with background-color instead of Top bar
– Header with logo
– no primary navigation below headerThanx in advance
PeterJanuary 1, 2019 at 9:25 am #770511Tom
Lead DeveloperLead DeveloperYou could try:
1. Enabling the Mobile Header: https://docs.generatepress.com/article/mobile-header/
2. Moving the mobile header above the site header with some PHP:
add_action( 'after_setup_theme', function() { remove_action( 'generate_after_header', 'generate_menu_plus_mobile_header', 5 ); add_action( 'generate_before_header', 'generate_menu_plus_mobile_header' ); } );
3. Forcing the site header to show on mobile even though the mobile header is used:
@media (max-width: 768px) { .site-header { display: block !important; } }
That should get you very close π
January 1, 2019 at 1:43 pm #770609Peter
Thanx a lot! It works.
Just copied your code and it was fine except for resetting the opacity for the header:
@media (max-width: 768px) { .site-header { display: block !important; opacity: 1; /* was 0 */ } }
The rest was just adjusting the layout to suite my site.
I’ll post a link once the site is online π
January 1, 2019 at 5:42 pm #770684Tom
Lead DeveloperLead DeveloperAwesome – thanks! π
January 6, 2019 at 10:36 am #774668Peter
The site is now online, and here is the link I promised:
The desktop version has a different header/menu order than the mobile version.
January 6, 2019 at 5:41 pm #774865Tom
Lead DeveloperLead DeveloperLooks great! π
June 27, 2019 at 12:47 am #942580Peter
Something has changed!
On mobile
– the navigation with menu and search is still visible on top alright
– but the.site-header
with logo on white background underneath has disappeared!As a result my visitors on mobile can’t see the site identity. Is this maybe due to changes in Customizer > Layout > Header? This “Branding Type” is something I cannot recall having seen before.
Anyway. The culprit seems to be the following rule:
.site-header, #site-navigation, #sticky-navigation { display: none !important; opacity: 0.0; }
Is that new? It is Inline CSS in the header: “generate-navigation-branding-inline-css”
If in a devtool I remove
.site-header
from the selectors everything is fine, but I can’t seem to fix that in my child-theme CSS.The rule I have in my child theme CSS for
.site-header
(see #770511 above from Tom) is overruled by above quoted rule.June 27, 2019 at 3:44 am #942682Peter
SEEMINGLY SOLVED π
Autoptimize has two options to aggregate CSS:
– Aggregate CSS-files?
– Also aggregate inline CSS?I had activated only the first option. In that case the load sequence is
1. Child-Theme-CSS
2. GP’s Inline CSS.
So the Inline CSS wins against my Child-Theme-CSS on “source order” (as described above).If both are activated the sequence is
1. GP’s Inline CSS first
2. Child-Theme-CSS.
So my Child-Theme-CSS wins.!important
*and* source order. We can’t take the cascade much further then this πJune 27, 2019 at 7:57 am #943002Tom
Lead DeveloperLead DeveloperGlad you found the solution! Thanks for posting it here π
-
AuthorPosts
- You must be logged in to reply to this topic.