Custom Menu – internal – external for logged-in and non-logged-in users

Viewing 2 posts - 1 through 2 (of 2 total)
  • #17058

    I have the Theme Esplanade and I want to create an internal section for logged in users.

    Logged-in users can see the menu “intern”
    Non-logged-in users can see the menu “hauptnavigation”

    I´ve tried to replace in the header.php this code:
    <?php wp_nav_menu( array( ‘theme_location’ => ‘primary_nav’ ) ); ?>

    with this new code:
    < ?php if (is_user_logged_in()) { ?>
    < ?php wp_nav_menu( array(‘menu’ =>’intern’, ‘menu_class’ => ‘nav-menu’ )); ?>
    < ?php }

    else { ?>
    < ?php wp_nav_menu( array(‘menu’ => ‘hauptnavigation’, ‘menu_class’ => ‘nav-menu’ )); ?>
    < ?php } ?>

    but I can´t see any navigation bar at all. It dissapeard completely and displayed the code text instead.

    Can you help me please?

    • This topic was modified 8 years, 10 months ago by satyasingh.
    Daniel Tara

    If it displayed the code text you probably edited the files using an editor that escaped the code after saving. To make sure the changes are saved as plain text use an editor like Sublime Text.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.