WordPress.org

Ready to get started?Download WordPress

Forums

Max Magazine
Multiple Menus + Drop-down menus (1 post)

  1. comforteagle03
    Member
    Posted 1 year ago #

    I'm trying to create separate menus. One for users who are logged in and another for those who are logged out. I've tweaked the code a bit and have it working however now the menu bar does not display the dropdown of child pages while hovering over it.

    From the functions file, this item allows for the dropdown child menus,

    function max_magazine_menu_fallback() { ?>
    		<ul class="menu">
    			<?php
      global $id;
      wp_list_pages("title_li=&child_of=$id&show_date=modified
      &date_format=$date_format"); ?>
    		</ul>
        <?php
    }

    and this displays it correctly in the header:

    <?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => 'max_magazine_menu_fallback',) ); ?>

    However this item from the functions page allows for alternating if the user is logged in or not:

    register_nav_menus( array(
          'logged-in-menu' => 'Logged In Menu',
          'logged-out-menu' => 'Logged Out Menu'
        )
      );

    and this is how it outputs within the header:

    <div id="nav">
        	<?php if ( is_user_logged_in() ) { wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) ); } else { wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) ); } ?>
    </div>

    Does anyone know how to do this or if it's even possible? I've looked throughout wp_nav_menu, register_nav_menus, and wp_list_pages but can't seem to find much either way.
    Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic