• Resolved Garry K

    (@garry-k)


    I’ve created 2 similar menus – logged_off and logged_on.

    I’ve copied the header.php file into my shell-lite-child theme.

    I’ve added this
    <?php
    if( is_user_logged_in() ) {
    $menu = ‘logged_on’;
    } else {
    $menu = ‘logged_off’;
    }

    <?php if (has_nav_menu('primary', 'shell')) { ?>
    
       <?php wp_nav_menu(array(
    	'container'      => '',
    	'menu_class'     => 'menu',
    	'theme_location' => 'primary')
    	);
            ?>
    
    <?php } else { ?>

    So how should I change the array to work with the $menu variable?

Viewing 1 replies (of 1 total)
  • Thread Starter Garry K

    (@garry-k)

    OK – I’ve figured it out

    I needed to insert ‘menu’ => $menu, before ‘container’ => ”,
    for the array.

    array(
    ‘menu’ => $menu,
    ‘container’ => ”,

    <?php
        if( is_user_logged_in() ) {
            $menu = 'logged_on_menu';
        } else {
            $menu = 'logged_off_menu';
        }
    ?>
    
    <?php if (has_nav_menu('primary', 'shell')) {
        ?>
            <?php wp_nav_menu(array(
    	    'menu'           => $menu,
                'container'      => '',
                'menu_class'     => 'menu',
                'theme_location' => 'primary') );
        ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Customizing menus’ is closed to new replies.