This question has been asked on this forum before, but all the answers, including the one below, seem outdated and do not work. (Unless I've missed a topic)
The Question is this: How does one specify two different (custom) navigation menus for users that are logged in and users that are not, via the functions.php?
One obvious solution would seem to be as per the code (or similar) before, i.e. add_/remove_action, based on menu.php. However, this no longer seems to work with Genesis 1.8 and Wordpress 3.++. Any ideas please? It's a pretty basic yet essential thing that should be possible to do, right?
(And yes, I admit, my php knowledge is limited — but growing... :) )
PHP Code:
//Custom Menus
remove_action('genesis_after_header', 'genesis_do_nav');
add_action('genesis_after_header', 'custom_genesis_do_nav');
function custom_genesis_do_nav() {
if ( is_user_logged_in() ) {
$nav = wp_nav_menu(array(
'theme_location' => 'primary',
'menu' => 27,
'container' => '',
'menu_class' => genesis_get_option('nav_superfish') ? 'nav superfish' : 'nav',
'echo' => 0
));
printf( '<div id="nav"><div class="wrap">%s</div></div>', $nav );
}
else {
$nav = wp_nav_menu(array(
'theme_location' => 'primary',
'menu' => 28,
'container' => '',
'menu_class' => genesis_get_option('nav_superfish') ? 'nav superfish' : 'nav',
'echo' => 0
));
printf( '<div id="nav"><div class="wrap">%s</div></div>', $nav );
}
}
Any help would be much appreciated... Thank you in advance.