So I’m quite new to the whole WordPress thing but I’m experienced with HTML/CSS anyway. I’ve created a new Menu within the Admin area of WordPress but when assigned to the theme, it still doesn’t show correctly. Apologies in advance if I’m being totally blind here but PHP isn’t my strong point too.
So below is the code in question, related to where the menu is in the header section:
<div id="nav-primary" class="nav"><nav>
<?php if ( is_user_logged_in() ) {
wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) ); /* if the visitor is logged in, this primary navigation will be displayed */
} else {
wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); /* if the visitor is NOT logged in, this primary navigation will be displayed. if a single menu should be displayed for both conditions, set the same menues to be displayed under both conditions through the WordPress backend */
} ?>
</nav></div><!--#nav-primary-->
I know that the ‘header-menu’ is pointing to a new Menu I set up, but it’s not showing the correct one. Instead, it’s showing lots of menu items, when the one I set up has only 4 items.
Can anyone shed any light on this at all? I would really appreciate some help.
Thanks!
Mark
Check this step.
Have you added this function in function.php file. If no add this.
/* Add two custom menu */
Have you selected menu from Appearance > Menu for both of your menu ? If no then create menu and select that.
Let me know still you need any help.
EDIT
New code for logged in and not logged in use menu.