Title: Problems with multiple menus
Last modified: August 19, 2016

---

# Problems with multiple menus

 *  [Jason Knight](https://wordpress.org/support/users/hihipattyrogan/)
 * (@hihipattyrogan)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/)
 * I’m making menus for logged off/in users. One or the other will show depending
   on whether they are logged in. It’s simple code,
 *     ```
       // Navigation menu
         if  (is_user_logged_in() ) {
        		register_nav_menus(
       		array(
       			'main' => __('User'),
       	} else {
                                   'visitor' => __( 'Visitor' )
       		)
       	);
       	};
       ```
   
 * But it keeps returning this error:
    Parse error: syntax error, unexpected ‘}’,
   expecting ‘)’ in C:\xampp\htdocs\mysite\wp-content\themes\THEME\functions.php
   on line 225
 * Line 255 being the one containing `} else {`
 * It’s pretty insane really. Any help? WP 3 menus amuse me by making me feel like
   a noob.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Jonas Grumby](https://wordpress.org/support/users/ss_minnow/)
 * (@ss_minnow)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1933979)
 * I’m not a code genius but here:
 *     ```
       register_nav_menus(
       		array(
       			'main' => __('User'),
       	} else {
       ```
   
 * you have three open parentheses and one closed parenthesis.
 * I know you have the closed parentheses later but the error message is saying 
   that it is expecting it sooner, so you may need them in both places.
 *  Thread Starter [Jason Knight](https://wordpress.org/support/users/hihipattyrogan/)
 * (@hihipattyrogan)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1933993)
 * It’s returning the same error… The code you gave me is the exact same one I have.
   I can’t close the tags sooner then they already are (At least I assume so). If
   I do, the visitor menu will be completely excluded.
 *  [Jonas Grumby](https://wordpress.org/support/users/ss_minnow/)
 * (@ss_minnow)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1934001)
 * The way you have it written, if the user is not logged in, they don’t get the
 *     ```
       register_nav_menus(
       array(
       ```
   
 * part. Do you want it that way?
 * You also need to have the final } in a place where it will apply to both conditions,
   so your closing parentheses may need to be after that.
 *  Thread Starter [Jason Knight](https://wordpress.org/support/users/hihipattyrogan/)
 * (@hihipattyrogan)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1934015)
 * I don’t want the logged off user to see the `'main' => __('User'),` and I don’t
   want the logged in users to see the `'visitor' => __( 'Visitor' )`
    But rather
   to see their respective menus.
 * When I change the location of the `if (is_user_logged_in() )` statement and change
   it to:
 *     ```
       register_nav_menus(
       		array(
        if  (is_user_logged_in() ) {
       			'main' => __('User'),
       	} else {
                                   'visitor' => __( 'Visitor' )
       		)
       	);
       	};
       ```
   
 * I get this error instead: `Parse error: syntax error, unexpected T_IF, expecting')'
   in C:\xampp\htdocs\mysite\wp-content\themes\THEME\functions.php on line 225`
 *  [Jonas Grumby](https://wordpress.org/support/users/ss_minnow/)
 * (@ss_minnow)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1934017)
 * I’m assuming that your code includes `<?php` and `?>` in some places.
 *  Thread Starter [Jason Knight](https://wordpress.org/support/users/hihipattyrogan/)
 * (@hihipattyrogan)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1934019)
 * Yes, but several items/attributes are inside one `<?php ?> tag`
    like
 *     ```
       // Theme features
         tb_add_theme_feature('query_vars', 'scheme');
   
         // Navigation menu
   
         if  (is_user_logged_in() )
         {
       ```
   
 * Those two are under the same tag

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Problems with multiple menus’ is closed to new replies.

## Tags

 * [multiple menus](https://wordpress.org/support/topic-tag/multiple-menus/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [Jason Knight](https://wordpress.org/support/users/hihipattyrogan/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/problems-with-multiple-menus/#post-1934019)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
