Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1360237

    How can i put a login/create account link in the menu or header?

    #1360242

    Hi jaliisah,

    You can add by adding this code in your child theme’s functions.php file:

    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 class="menu-item"><a href="/wp-login.php?action=logout">Log Out</a></li>';
        }
        elseif (!is_user_logged_in() && $args->theme_location == 'avia') {
            $items .= '<li class="menu-item"><a href="/wp-login.php">Log In</a></li>';
    		$items .= '<li class="menu-item"><a href="/wp-login.php?action=register">Register</a></li>';
        }
        return $items;
    }

    Let us know if this helps.

    Best regards,
    Nikko

    #1360342

    That helped! Many thanks!

    #1360353

    Hi,

    Great, I’m glad that Nikko could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1360360

    You can close it Thank you again.

    #1360364

    Hi,

    Thanks for letting us know, I’ll close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Log In/Create Account’ is closed to new replies.