Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
Created May 31, 2013 00:42
Show Gist options
  • Save WebEndevSnippets/5682311 to your computer and use it in GitHub Desktop.
Save WebEndevSnippets/5682311 to your computer and use it in GitHub Desktop.
Genesis: Add Top Navigation for Genesis 2.0 with HTML5 Activated
ADD FOLLOWING CODE TO FUNCTIONS FILE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Register Genesis Menus
add_theme_support ( 'genesis-menus' , array ( 'primary' => 'Primary Navigation Menu' , 'secondary' => 'Secondary Navigation Menu' ,'top' => 'Top Navigation Menu' ) );
// Add Custom Top Navigation
add_action('genesis_before_header', 'custom_top_nav');
function custom_top_nav() {
echo '<nav class="nav-top" role="navigation" itemscope itemtype="http://schema.org/SiteNavigationElement">';
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'wrap' , 'menu_class' => 'menu genesis-nav-menu menu-top', 'theme_location' => 'top') );
echo '</nav>';
}
ADD FOLLOWING CODE STYLE SHEET
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* Top Navigation
--------------------------------------------- */
.nav-top {
background: #222;
border-bottom: 1px solid #444;
}
.nav-top a {
background: #222;
padding: 14px 20px;
padding: 1.4rem 2rem;
}
.nav-top a:hover {
background: #111;
color: #fff;
}
.nav-top .current-menu-item > a {
background: #D24D33;
color: #fff;
}
.nav-top .sub-menu a {
background: #222;
color: #ccc;
}
.nav-top .sub-menu a:hover {
background: #111;
color: #fff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment