Footer Navigation Menu in Genesis

Posted on
5/5 - (335 votes)

Genesis Sample child theme has code to rename secondary navigation location as Footer Menu and show the menu assigned to that location inside the footer.

//* Rename primary and secondary navigation menus
add_theme_support( 'genesis-menus' , array( 'primary' => __( 'After Header Menu', 'genesis-sample' ), 'secondary' => __( 'Footer Menu', 'genesis-sample' ) ) );

and

add_action( 'genesis_footer', 'genesis_do_subnav', 5 );

We can instead register a custom footer theme location and display the menu assigned to it above the footer content like so:

// Add footer theme location
add_theme_support( 'genesis-menus' , array(
	'primary' => __( 'After Header Menu', 'genesis-sample' ),
	'secondary' => __( 'Secondary Navigation Menu', 'genesis-sample' ),
	'footer' => __( 'Footer Navigation Menu', 'genesis-sample' )
) );

// Add typical attributes for footer navigation elements.
add_filter( 'genesis_attr_nav-footer', 'genesis_attributes_nav' );

// Display Footer Navigation Menu above footer content
add_action( 'genesis_footer', 'sk_do_footernav', 5 );
/**
 * Echo the "Footer Navigation" menu.
 *
 * @uses genesis_nav_menu() Display a navigation menu.
 * @uses genesis_nav_menu_supported() Checks for support of specific nav menu.
 */
function sk_do_footernav() {

	//* Do nothing if menu not supported
	if ( ! genesis_nav_menu_supported( 'footer' ) )
		return;

	$class = 'menu genesis-nav-menu menu-footer';
	if ( genesis_superfish_enabled() ) {
		$class .= ' js-superfish';
	}

	genesis_nav_menu( array(
		'theme_location' => 'footer',
		'menu_class'     => $class,
	) );

}