Naijaping

add custom login page link and logout link to WP Nav

Oct 25th, 2014
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. function madd_login_logout_link($items, $args)
  2. {
  3. if(is_user_logged_in())
  4. {
  5. $newitems = '<li><a title="Logout" href="'. wp_logout_url('index.php') .'">log out</a></li>';
  6. $items .= $newitems;
  7. }
  8. else
  9. {
  10. $newitems = '<li class="nav-login"><a href="/login-now">Login</a></li>';
  11. $items .= $newitems;
  12. }
  13. return $items;
  14. }
  15. add_filter('wp_nav_menu_items', 'madd_login_logout_link', 10, 2);
Advertisement
Add Comment
Please, Sign In to add comment