Lego2012
12/13/2016 - 4:39 PM

How to Add “Top” and “Footer” Menus to Genesis

How to Add “Top” and “Footer” Menus to Genesis

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

// Register and Hook Top Navigation Menu
add_action('genesis_before_header', 'sample_before_header_menu', 10);
    function sample_before_header_menu() {

    register_nav_menu( 'top', 'Top Navigation Menu' );
    
    genesis_nav_menu( array(
        'theme_location' => 'top',
        'menu_class'     => 'menu genesis-nav-menu menu-top',
    ) );
}

// Register and Hook Footer Navigation Menu
add_action('genesis_before_footer', 'sample_footer_menu', 10);
    function sample_footer_menu() {

    register_nav_menu( 'footer', 'Footer Navigation Menu' );
    
    genesis_nav_menu( array(
        'theme_location' => 'footer',
        'menu_class'     => 'menu genesis-nav-menu menu-footer',
    ) );
}

// Add Theme Support for Genesis Menus
add_theme_support( 'genesis-menus', array( 
    'primary'   => __( 'Primary Navigation Menu', 'genesis' ),
    'secondary' => __( 'Secondary Navigation Menu', 'genesis' ),
    'top'       => __( 'Top Navigation Menu', 'genesis' ),
    'footer'    => __( 'Footer Navigation Menu', 'genesis' ),
) );

// Add Structural Wraps
add_theme_support( 'genesis-structural-wraps', array(
    'menu-top',
    'menu-footer',
    'header',
    'nav',
    'subnav',
    'site-inner',
    'footer-widgets',
    'footer'
) );

// Add Attributes for Navigation Elements
add_filter( 'genesis_attr_nav-top', 'genesis_attributes_nav' );
add_filter( 'genesis_attr_nav-footer', 'genesis_attributes_nav' );