Hi padman,
This could be achieved by making use of our available public functions. Displaying different menus based on whether or not someone is logged in is something that is discussed in our tutorial video for the public functions, which you can watch here: https://www.youtube.com/watch?v=bKiJAjq7PhQ.
Hi Etoile,
i was added code like this in the theme function.php file, it show fatal error. any modification in this code, please help me
add_filter( ‘wp_nav_menu’, ‘wti_loginout_menu_link’, 10, 2 );
function wti_loginout_menu_link($items, $FEUP )
{
$FEUP = new FEUP_User;
if($FEUP -> Is_Logged_In())
{
$items .= wp_nav_menu(array(‘menu’ => ‘Login’));
}
else
{
$items .= wp_nav_menu(array(‘menu’ => ‘Top-Menu’));
}
return $items;
}
Thank you
Hi,
The code should be added directly to the template file that you want to change (e.g. header.php, page.php, single.php, etc.)
Hi Etoile,
Thank you so much for replaying.
i was added code in heade.php and page.php but it is showing duplicate menu in the page.
this is i added code like this.
<?php
$FEUP = new FEUP_User;
if($FEUP -> Is_Logged_In())
{
wp_nav_menu(array(‘menu’=>’Login’));
}
else
{
wp_nav_menu(array(‘menu’=>’Top-Menu’));
}
?>
Please check this is my website url : http://hurify.co/
user name : pakki1246@gmail.com
password : gagan@143
Thank you
Hi,
It looks like you’re using the code in the right way. Did you delete the spot in your theme template files where the menu is currently being generated? Not being familiar with your theme or site, I don’t know exactly how or where the menu is generated, but it would seem to me that you would need to delete the original menu if you’re going to be adding it back in with the new code.