Tagged: footer menu, log in
I have searched the forums, but can’t seem to find an answer.
I am trying to add a contextual “Log In” link to the footer menu. Where it will change to “Log Out” based on in the user being logged in. I found a function below which adds it in each menu, but I really only want it in the footer.
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
ob_start();
wp_loginout('index.php');
$loginoutlink = ob_get_contents();
ob_end_clean();
$items .= '- '. $loginoutlink .'
';
return $items;
}
Any help would be much appreciated.
C
Thank you for the help.