Home › Support Forums › Theme Support › Enlightenment › Second Menu on Home › Reply To: Second Menu on Home
bo-oz
Participant
Adding these lines just tells WordPress that the theme contains a primary and a secondary menu. You still need to include the menu in the HTML template. Today I made something similar, I’ll share it with you:
add_action( 'init', 'register_user_menu' );
function register_user_menu() {
// just registering the menu
register_nav_menu('user-menu',__( 'User Menu' ));
}
// I'm injecting the menu in the 'enlightenment_before_header', you can also use a different hook for a different position inside the code, just take a look at header.php
add_filter('enlightenment_before_header','enlightenment_before_header_bo');
function enlightenment_before_header_bo() {
if ( is_user_logged_in() ) {
// deleted this code, because it is website specific.
} else {
// this actually creates a div and echo's the custom menu inside the theme
echo '<div class="top-user-menu">'.wp_nav_menu( array( 'theme_location' => 'user-menu', 'echo' => false ) ).'</div>';
}
}