Guest User

Canvas Woothemes - logout to top menue

a guest
Dec 25th, 2013
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
  2. function add_loginout_link( $items, $args ) {
  3. if (is_user_logged_in() && $args->theme_location == 'top-menu') {
  4. $items .= '<li><a href="'. wp_logout_url() .'">Log Out</a></li>';
  5. }
  6. elseif (!is_user_logged_in() && $args->theme_location == 'top-menu') {
  7. $items .= '<li><a href="'. site_url('wp-login.php') .'">Log In</a></li>';
  8. }
  9. return $items;
  10. }
Add Comment
Please, Sign In to add comment