Created
August 9, 2014 15:51
-
-
Save iambigd/57175bd5e99fde54ec4a to your computer and use it in GitHub Desktop.
woocommerce 加入登入登出按鈕
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_login_logout_link($items, $args) | |
{ | |
if(is_user_logged_in() && $args->theme_location == 'avia2') | |
{ | |
$newitems = '<li><a title="'.__('Logout','avia_framework').'" href="'. wp_logout_url(get_permalink()) .'">'.__('Logout','avia_framework').'</a></li>'; | |
$newitems .= $items; | |
} | |
else if($args->theme_location == 'avia2') | |
{ | |
$newitems = '<li><a title="'.__('Login','avia_framework').'" href="'. wp_login_url(get_permalink()) .'">'.__('Login','avia_framework').'</a></li>'; | |
$newitems .= $items; | |
}else{ | |
$newitems .= $items; | |
} | |
return $newitems; | |
} | |
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment