Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Last active December 15, 2020 23:11
Show Gist options
  • Save mjsdiaz/8730c43499cacbfcab8c to your computer and use it in GitHub Desktop.
Save mjsdiaz/8730c43499cacbfcab8c to your computer and use it in GitHub Desktop.
Add Third or Footer Navigation Menu to Genesis Child Theme - https://amethystwebsitedesign.com/add-third-footer-navigation-menu-to-genesis-child-theme
<?php
// Remove the line above when adding to functions.php
// Add theme support for new menu
// Add New Footer Menu; Keep Primary and Secondary Menus
add_theme_support ( 'genesis-menus' , array (
'primary' => __( 'Primary Navigation Menu', 'genesis' ),
'secondary' => __( 'Secondary Navigation Menu', 'genesis' ),
'footer' => __( 'Footer Navigation Menu', 'genesis' )
) );
// Add footer menu just above footer widget area
add_action( 'genesis_before_footer', 'amethyst_footer_menu', 9 );
function amethyst_footer_menu() {
genesis_nav_menu( array(
'theme_location' => 'footer',
'container' => 'div',
'container_class' => 'wrap',
'menu_class' => 'menu genesis-nav-menu menu-footer',
'depth' => 1
) );
}
// Add attributes to markup
// http://www.rfmeier.net/using-genesis_markup-with-html5-in-genesis-2-0/
add_filter( 'genesis_attr_nav-footer', 'custom_add_nav_footer_attr' );
function custom_add_nav_footer_attr( $attributes ){
// add role
$attributes['role'] = 'navigation';
// add itemscope
$attributes['itemscope'] = 'itemscope';
// add the site navigation schema
$attributes['itemtype'] = 'http://schema.org/SiteNavigationElement';
// return the attributes
return $attributes;
}
.nav-footer {
background-color: #333;
}
.nav-footer .genesis-nav-menu a {
color: #fff;
}
.nav-footer .genesis-nav-menu a:hover {
color: #e5554e;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment