Updated on April 25, 2018
The recently released Genesis Sample 2.6.0 is close to perfection as my ideal starter Genesis child theme.
That said, there are still a few things that could be improved in my opinion and I list the theme changes and fixes below.
Most of these will hopefully be fixed by StudioPress in the next update.
Menu items flash
From 959px and below on a desktop i.e., when the nav menu items collapse into the hamburger menu, reloading the page will/might show a flash of the menu items briefly below the site title before the hamburger icon appears.
This can be fixed by installing Gary Jones’ Genesis JS / No JS plugin and adding this CSS:
.js nav {
display: none;
}
@media only screen and (min-width: 960px) {
.js nav {
display: block;
}
}
Header floats
.title-area
and .nav-primary
and floated left and right respectively inside .site-header > .wrap
.
These can be removed and Flexbox used for 960px and above like so:
@media only screen and (min-width: 960px) {
.site-header .wrap {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.title-area {
float: none;
}
.nav-primary {
float: none;
margin-left: auto;
}
}
This will have the added benefit of keeping the two elements vertically centered when JS is off in the browser.
i.e., this will fix:
Primary nav’s wrap
I am a fan of least possible HTML markup (which is why I dislike page builders).
As such we can remove .nav-primary
‘s .wrap
(assuming that you want primary nav to be at the right side in the header and not below like in the older theme version) by adding this in functions.php:
// Remove `.menu-primary` from structural wrap.
add_theme_support( 'genesis-structural-wraps', array( 'header', 'menu-secondary', 'footer-widgets', 'footer' ) );
With JS turned off
Submenus will not appear in the mobile menu when Javascript is disabled.
This can be fixed by adding display: block
to .genesis-nav-menu .menu-item:hover > .sub-menu
.
.genesis-nav-menu .menu-item:hover > .sub-menu {
left: auto;
opacity: 1;
display: block;
}
and to fix the width of submenus, change (inside the 960 min-width media query)
.genesis-responsive-menu .genesis-nav-menu .sub-menu,
.genesis-responsive-menu .genesis-nav-menu .sub-menu a {
width: 180px;
}
to
.genesis-nav-menu .sub-menu,
.genesis-nav-menu .sub-menu a {
width: 180px;
}
No Sidebar Layout
960px and above, .content
will have a width of 65%. This should be set to 100% for pages that use the full content layout.
Inside the min-width 960 media query below
.content {
float: left;
width: 65%;
}
add
.full-width-content .content {
float: none;
width: 100%;
}
Equal height Content and Sidebar
https://sridharkatakam.com/equal-height-content-and-sidebar-in-genesis-sample-2-6-0/
Thanks to Marcy Diaz and Robin Cornett.
Excellent work…really like the new sample theme.
Hi Sridhar,
Great thinking! Question. My development server currently doesn’t run php 7.0 or higher. Is there an alternative for Genesis JS / No JS ? Doesn’t run below 7.
Hope there is,
Regards.
Is your dev server online or on your computer?
On my pc. Using Desktopserver from Serverpress.
Try adding this in child theme’s functions.php:
Source: https://github.com/GaryJones/genesis-js-no-js/blob/master/src/FrontEnd.php
Thanks Sridhar, it’s working! But I still wonder why the plugin requires a minimal php 7 to work. This solution works for me, thanks again.
Hi Sridhar, do you work with straight CSS when building from sample themes like this or do you create SASS versions? Thanks
CSS.
I understand the benefits of Sass but somehow it hasn’t stuck with me.
Thanks Sridhar…
Hi Sridhar,
About submenus will not appear in the mobile menu when JavaScript is disabled…
.genesis-nav-menu .menu-item:hover > .sub-menu {
left: auto;
opacity: 1;
display: block; /* Fix no JS */
}
When JavaScript is enabled, to avoid submenu appears by hovering over the menu item after the fix, i have added:
.genesis-responsive-menu .genesis-nav-menu .menu-item:hover > .sub-menu {
display: none; /* Fix with JS */
}
This has worked
THANK YOU SO MUCH… for providing the solution to the desktop menu flashing on mobile devices.
This happens on ALL Studio Press themes I use, and have asked all over the place of how to fix this (including Studio Press) –and I have never found the answer. FYI… I tried your solution above on the Magazine Pro and Academy pro themes (with the Gary Jones’ Genesis JS / No JS plugin ) — and it works! FINALLY!
That is such an annoying bug in their themes –and makes for a very poor mobile experience.
Thanks again.
Hi Sridhar, implementing your header floats CSS above ‘floats’ the navigation over to the left against the logo unless I leave the original Genesis ‘width: auto;’ declaration in .nav-primary. Now my CSS reads:
.nav-primary {
width: auto;
float: none;
margin-left: auto;
}
Is this correct or have I missed something in your implementation? Thanks, David
Hi Sridhar, I have implemented your header floats > flexbox code as above but would also like to move the secondary navigation above site header as a ‘Utility’ menu. Do you have an example of how to do this? Thanks!
After the secondary nav is moved to above the site header, how do you want them to behave sticky-wise? Should both secondary nav + header be fixed when one scrolls down?
Yes Sridhar, both fixed… Thanks
Follow https://sridharkatakam.com/fixed-secondary-nav-site-header-in-genesis-sample/.
Perfect, thanks Sridhar…
I am really annoyed with menu flashing. Tried the solution for Magazine pro but it didn’t help.. Please, advice me, maybe I should change something in the css code? Thank you very much!
Hi Sridhar, I have implemented your ‘remove header floats’ code above which works great. However, on a specific landing page template within the site I’d like to call the Header Right Widget Area back in and replace the primary nav menu with a flexbox positioned widget area so I can add an image instead of the menu. Any help would be much appreciated.
Hi Sridhar, do you have any plans to update this to the latest version of Genesis Sample? Thanks!
dear sir, thanks for your tutorial.
sir im facing a problem. when im applying no-js and CSS it is disappearing my nav-secondary which is located in footer area… plz help me. the page where im getting problem- https://techmyhobby.com/
I am a traditionalist and I prefer the primary nav menu to stretch across the page below the header (as the old Sample theme did). How can I move it back there with least amount of fuss?
Hey, thank you a ton for the fix. It fixed the mobile menu flash on my site perfectly.
However, now I’m noticing that since the menu isn’t displayed at all at first, it causes some layout shift once it’s loaded in. Is there any way to reserve space for the menu before it loads to fix this?
My site is: https://www.swiftsalary.com