-
-
Save robincornett/5952e2b4bbb012f7941673751d24522f to your computer and use it in GitHub Desktop.
Conditionally move the primary nav into the header, if no header right widget area is active.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'genesis_before_header', 'leaven_maybe_move_primary_nav' ); | |
/** | |
* Maybe move the primary navigation to the header (if no widget in header-right). | |
*/ | |
function leaven_maybe_move_primary_nav() { | |
if ( is_active_sidebar( 'header-right' ) ) { | |
return; | |
} | |
remove_action( 'genesis_after_header', 'genesis_do_nav' ); | |
add_action( 'genesis_header', 'genesis_do_nav', 11 ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ## Full Width Header | |
----------------------------------------- */ | |
.header-full-width .title-area { | |
-webkit-box-flex: 1; | |
-webkit-flex-grow: 1; | |
-ms-flex-positive: 1; | |
flex-grow: 1; | |
} | |
.header-full-width .nav-primary { | |
background-color: transparent; | |
-webkit-box-flex: 1; | |
-webkit-flex-grow: 1; | |
-ms-flex-positive: 1; | |
flex-grow: 1; | |
max-height: 76px; | |
z-index: 100; | |
} | |
.header-full-width .nav-primary .menu-item:last-of-type > a { | |
padding-right: 0; | |
} | |
.header-full-width .nav-primary .genesis-nav-menu { | |
text-align: right; | |
} | |
.header-full-width .nav-primary .genesis-nav-menu .menu-item:hover .sub-menu .sub-menu { | |
margin: -55px 0; | |
left: -199px; | |
} | |
.header-full-width .site-header { | |
background-color: #292929; | |
background-color: rgba(41, 41, 41, 0.9); | |
width: 100%; | |
z-index: 800; | |
} | |
.header-full-width .site-header > .wrap { | |
display: -webkit-box; | |
display: -webkit-flex; | |
display: -ms-flexbox; | |
display: flex; | |
-webkit-box-pack: justify; | |
-webkit-justify-content: space-between; | |
-ms-flex-pack: justify; | |
justify-content: space-between; | |
padding: 0; | |
} | |
.header-full-width .site-title a, | |
.header-full-width .site-title a:hover, | |
.header-full-width .site-description { | |
color: #fff; | |
} | |
.header-full-width.header-image .title-area { | |
padding: 0; | |
} | |
/* ## Widget Area | |
--------------------------------------------- */ | |
.site-header .widget-area { | |
-webkit-box-ordinal-group: 4; | |
-webkit-order: 3; | |
-ms-flex-order: 3; | |
order: 3; | |
width: 100%; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment