Reply To: Secondary navigation menu after slider.

#22794
Daniel Tara
Keymaster

Here’s a reliable way to add a navigation menu after the slider:

function enlightenment_child_register_secondary_navigation() {
    register_nav_menu(
        'secondary',
        __( 'Secondary Menu', 'enlightenment' )
    );
}
add_action( 'after_setup_theme', 'enlightenment_child_register_secondary_navigation' );

function enlightenment_child_secondary_navigation() {
    if( 'header' != enlightenment_current_sidebar_name() ) {
        return;
    }

    wp_nav_menu();
}
add_action( 'get_sidebar', 'enlightenment_child_secondary_navigation' );

function enlightenment_child_secondary_nav_menu_args( $args ) {
    if( ! doing_action( 'get_sidebar' ) ) {
        return $args;
    }

    $args['theme_location']  = 'secondary';
    $args['container_class'] = 'secondary-navigation';
    $args['container_id']    = 'secondary-navigation';
    $args['walker']          = '';

    return $args;
}
add_action( 'wp_nav_menu_args', 'enlightenment_child_secondary_nav_menu_args', 22 );

Now you’ll have a secondary navigation with a dedicated location and a container class and id of secondary-navigation