Support » Themes and Templates » [Resolved] Login Form

[Resolved] Login Form

Viewing 8 replies - 1 through 8 (of 8 total)
  • In the header where?
    for the last link, look for Nicolas answer:

    Hi Fadi, you can use the hooks provided in the snippet and add the wp_login_form() function to one of them.
    More about wp_login_form() : http://codex.wordpress.org/Function_Reference/wp_login_form

    Hope this helps

    About the login form, is a wordpress “issue”, you can find a lot of good way to achieve that just googling for “customize worpdress login form”.

    on right,like themesandco.com; there is anywhere the code for this?

    i copy it in functions.php of my child-theme but they don’t work…:(

    //Add login/logout link to naviagation menu
    function add_login_out_item_to_menu( $items, $args ){
    	//change theme location with your them location name
    	if( is_admin() ||  $args->theme_location != 'primary' )
    		return $items; 
    	$redirect = ( is_home() ) ? false : get_permalink();
    	if( is_user_logged_in( ) )
    		$link = '<a href="' . wp_logout_url( $redirect ) . '" title="' .  __( 'Logout' ) .'">' . __( 'Logout' ) . '</a>';
    	else  $link = '<a href="' . wp_login_url( $redirect  ) . '" title="' .  __( 'Login' ) .'">' . __( 'Login' ) . '</a>';
    	return $items.= '<li id="log-in-out-link" class="menu-item menu-type-link">'. $link . '</li>';
    }add_filter( 'wp_nav_menu_items', 'add_login_out_item_to_menu', 50, 2 );

    i’ve already changed the name of the primary menu in “primary” but nothing….

    i’ve find this code and it work; i don’t know why but it work! XD

    function add_login_logout_link($items, $args)
    $newitems = '<li><a title="Logout" href="'. wp_logout_url('index.php') .'">Logout</a></li>';
    $items .= $newitems;
    $newitems = '<li><a title="Login" href="'. wp_login_url('index.php') .'">Login</a></li>';
    $items .= $newitems;
    return $items;
    add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

    Use this:

    //change theme location with your them location name
    	if( current_user_can('create_users') ||  $args->theme_location != 'main' )
    		return $items;

    instead of:

    //change theme location with your them location name
    	if( is_admin() ||  $args->theme_location != 'primary' )
    		return $items;

    is_admin() is used not correctly. And the theme location for customizr main menu is “main”.
    Anyway that if statement will not show you the “login/logout” link if you’re logged in as administrator. So if you don’t want this “feature” then remove that block.

    Hope this helps.

    Don’t know why? ‘Cause it basically do the same thing but with different controls.
    Glad you solved.
    Would you mind marking this topic as solved?
    Thank you.

    oh thank you very much!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Login Form’ is closed to new replies.