Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 Answer 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

share|improve this answer
    
THIS WORKED LIKE A CHARM>>>> THANK YOU. –  Kev Hopwood Jun 10 '13 at 16:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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