I am working on a web app word press. I am new to word press So maybe you will feel that this question is silly, I tried everything but i don't want to use any plugin.
here is what I need to show the register/login menu item to non-logged-in users and profile/logout menu item to logged-in-users. But In my website I am not using word press login function wp_login() I am using web service to get the login response and then I am using sessions to control the user data and access the user data on a different page.
On profile pages I have done
if(!isset($_SESSION['user'])){
header("Location:http://localhost:8080/wordpress/login/");
}
else {
//page content
}
I have tried this, but its not working
function my_wp_nav_menu_args( $args = '' ) {
if( isset($_SESSION['user']) ) {
$args['menu'] = 'logged-in';
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
But how can i do this with menu items ??