Hello, I’m wondering if this will work in the main nav menu?
https://kriesi.at/support/topic/submenu-adding-dropdownhover-loginlogout-widgetbuttons/
Thank you!
Hey soundstrat,
Please try adding this code to the end of your functions.php file in Appearance > Editor, and changing the links to match your site:
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if (is_user_logged_in() && $args->theme_location == 'avia') {
$items .= '<li><a href="http://127.0.0.1/wp-login.php?action=logout">Log Out</a></li>';
}
elseif (!is_user_logged_in() && $args->theme_location == 'avia') {
$items .= '<li><a href="http://127.0.0.1/wp-login.php">Log In</a></li>';
}
return $items;
}
Best regards,
Mike