Jump to content
Sign in to follow this  
Brian

Login/Logout Link

Recommended Posts

Brian

Hello, I have both BrandNav and Nav Classic activated in the header and I'm trying to add a login/logout link (without using a plugin) to the menu. Does anyone know how to adjust this code to show a login/logout link only in the BrandNav menu? And so it's inline with the other menu links and a class can be assigned with it? Open to other solutions too. Thanks, Brian

function add_login_logout_link($items, $args)
	{
	  if(is_user_logged_in())
	  {
	    $newitems = 'Logout';
	    $newitems .= $items;
	  }
	  else
	  {
	    $newitems = 'Login';
	    $newitems .= $items;
	  }
	  return $newitems;
	}
	add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);[/code]

Share this post


Link to post
Share on other sites
catrina

If you use the hook brandnav_after_brand in the functions.php file, you can probably add it so that it looks like it belongs with the menu.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
Danny

HI, Did Catrina's or Batman's suggestions work ?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×