1

I am looking to move the login / logout / my account / register details currently situated under my menu bar to above the menu bar.

Essentially I want to add the details just after the header.

What do I need to add to my functions.php file in my child theme for this to work?

  • Can you please post the relevant code? What code is outputting the login/logout/register/my account details, and what code is outputting your menu bar? – Chip Bennett Feb 4 '13 at 14:46
1

Here is a function i use to display the log in/out and registration URLs

//Add login/logout link to naviagation menu
function add_login_out_item_to_menu_wpa84418( $items, $args ){

    //change theme location with your them location name
    if( is_admin() ||  $args->theme_location != 'LOCATION' )
        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>';
        if (get_option('users_can_register'))
            $link = wp_register('<li>', '</li>', false) . $link;

    }
    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_wpa84418', 50, 2 );

Just make sure you change theme LOCATION with your them location name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.