Skip to content

Instantly share code, notes, and snippets.

@saltnpixels
Created November 16, 2015 18:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save saltnpixels/77edb1bc666b1dad6226 to your computer and use it in GitHub Desktop.
adds login menu item to navigation
//add login to nav menu. wordpress example doesnt work! needed to play with it. login menu item added!
add_filter( 'wp_nav_menu_items', 'add_loginout_link', 10, 2 );
function add_loginout_link( $items, $args ) {
if ($args->theme_location == 'primary') {
$loginout = '<li class="nav-menu menu-item loginout login-icon">' . wp_loginout($_SERVER['REQUEST_URI'], false ) . '</li>';
$items .= $loginout;
return $items;
}
else
return $items;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment