Viewing 2 replies - 1 through 2 (of 2 total)
  • chillamor,

    This might help but it’s not a plugin. I added the following directly to the very end of my theme functions.php. It adds a link to your primary menu and runs from wp-login. It redirects user right back to the current page so users do not have to go to their profile at all. It works well on my site using WP 4.01. Just make sure you add the name of your primary navigation menu where it is indicated below, (replace the uppercase text).

    You can see it here: http://pain-and-depression.com/Library/front_page/

    Unfortunately, I cannot put the code into Dutch, but I hope this gives you a start.

    //Add login/logout link to primary navigation menu 
    
    add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
    function add_login_logout_link($items, $args)  {
    
      //replace uppercase text with name of your primary menu
    
    	if( is_admin() ||  $args-> INSERT THE NAME OF YOUR PRIMARY NAVIGATION MENU != 'primary' )
    		return $items; 
    
    	$redirect = ( is_home() ) ? false : get_permalink();
    	if( is_user_logged_in( ) )
    		$link = '<a href="' . wp_logout_url( $redirect ) . '" title="' 
    
    .  __( 'Log out' ) .'">' . __( 'Log out' ) . '</a>';
    	else  $link = '<a href="' . wp_login_url( $redirect  ) . '" title="' .  
    
    __( 'Log in' ) .'">' . __( 'Log in' ) . '</a>';
    
    	return $items.= '<li id="log-in-out-link">'. $link . '</li>';
    }
    Thread Starter chillamor

    (@chillamor)

    Summer,

    Thanks for your willingness to help.

    I am not able to use this because I only work with plugins, not with extra coding. This is difficult to maintain.

    Chillamor

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Login, logout, register’ is closed to new replies.