trouble adding two menus to the same page
-
Hello,
I am having trouble adding two menus to the same page. I have created the menu locations and registered the menus via functions.php. I have also created menu items for both menus.function register_new_nav_menus() { register_nav_menus( array( 'header-menu' => __( 'Header Menu' ) 'filter-menu' => __( 'Filter Menu' ) )); } add_action( 'init', 'register_new_nav_menus' );
I then call each menu via a separate function:
function filter_menu() { ?> <div class="rainbow-bar"> <div class="rainbow1 rainbow" style="height: 100%; opacity: 1;"></div> <div class="rainbow2 rainbow" style="height: 100%; opacity: 1;"></div> <div class="rainbow3 rainbow" style="height: 100%; opacity: 1;"></div> <div class="rainbow4 rainbow" style="height: 100%; opacity: 1;"></div> <div class="rainbow5 rainbow" style="height: 100%; opacity: 1;"></div> </div> <div class="navigation"> <nav> <ul class="nav"> <?php if (get_field('logo_option', 'option') == "Text") { ?> <li class="logo"> <a onClick="location.href='<?php echo home_url(); ?>'"> <?php the_field('logo_text', 'option'); ?> </a> </li> <?php } ?> <?php if (get_field('logo_option', 'option') == "Image") { ?> <li class="logo-image"> <a onClick="location.href='<?php get_bloginfo('url') ?>'"> <img src="<?php the_field('logo_image', 'option'); ?>"/> </a> </li> <?php } ?> <?php $defaults = array( 'theme_location' => 'filter-menu', 'menu' => '', 'container' => '', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '%3$s', 'depth' => 0, 'walker' => new MV_New_Walker_Nav_Menu() ); ?> <?php wp_nav_menu( $defaults ); ?> </ul> </nav> </div> <?php }
However, when I call the menus from within the template using:
<?php header_menu(); ?>
<?php filter_menu(); ?>only the last menu called is displayed. For example, if I put header_menu(); last then the header menu shows. If I put filter_menu(); last then the filter menu shows. Is two menus on the same page not possible?
- The topic ‘trouble adding two menus to the same page’ is closed to new replies.