Tagged: woocommerce
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
May 3, 2013 at 7:17 pm #22788
Hi there, you said, Enfold ist Woocomerce compatible. How can I integrate a Login / Logout link into the top header?
May 4, 2013 at 11:10 am #117233Insert following code at the bottom of functions.php:
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);You maybe need to replace “avia2” with “avia” or “avia3” (depends on the menu you want to use for the login/logout links).
May 4, 2013 at 3:43 pm #117234Great, thx. The Login / Logout is now 1st point in the navigation. Is there a way to put it at the end, just before the search button?
May 4, 2013 at 3:49 pm #117235Yes, use following code:
function add_login_logout_link($items, $args)
{
if(is_user_logged_in() && $args->theme_location == 'avia2')
{
$newitems = $items;
$newitems .= '<li><a title="'.__('Logout','avia_framework').'" href="'. wp_logout_url(get_permalink()) .'">'.__('Logout','avia_framework').'</a></li>';
}
else if($args->theme_location == 'avia2')
{
$newitems = $items;
$newitems .= '<li><a title="'.__('Login','avia_framework').'" href="'. wp_login_url(get_permalink()) .'">'.__('Login','avia_framework').'</a></li>';
}else{
$newitems .= $items;
}
return $newitems;
}
add_filter('wp_nav_menu_items', 'add_login_logout_link', 5, 2);May 4, 2013 at 3:51 pm #117236Super, perfekt. Danke!
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)
- The topic ‘WooCommerce Login on Top’ is closed to new replies.
