Login and signup buttons on top of page


I’d like to know how to add “Login” and “sign up” buttons on top of the pages, and the individual pages for login and signup. Also, after the users log in, their user name is shown on top the page instead of “login” and “sign up” buttons.



  • Timothy
    • Chief Pigeon

    Hey there.

    There are a few options, you can use the Membership login widget and place that within a widget area.

    Or you could look at doing something custom in your theme:


    So if you’d like it in the top of your theme the chances are it would be the header.php file you might need.

    If you want it along the top of pages, as in the content area then you could hook this in:


    So in the second part there you’re saying you want the form to show, but once logged in it show’s their username instead?

    As quick example (you need to make make $current_user a global – See link above):

    if ( is_user_logged_in() ) {
    echo 'Username: ' . $current_user->user_login . "n";
    } else {

    Hope this helps, let me know if you have any further questions.

  • David
    • WPMU DEV Initiate

    Hi Jack,

    I did copy and paste the exact same codes into the php files, but it didn’t seem to work. I guess I might have got it wrong somewhere. for example, I pasted these lines in the header.php file:

    <?php $args = array(

    ‘echo’ => true,

    ‘redirect’ => site_url( $_SERVER ),

    ‘form_id’ => ‘loginform’,

    ‘label_username’ => __( ‘Username’ ),

    ‘label_password’ => __( ‘Password’ ),

    ‘label_remember’ => __( ‘Remember Me’ ),

    ‘label_log_in’ => __( ‘Log In’ ),

    ‘id_username’ => ‘user_login’,

    ‘id_password’ => ‘user_pass’,

    ‘id_remember’ => ‘rememberme’,

    ‘id_submit’ => ‘wp-submit’,

    ‘remember’ => true,

    ‘value_username’ => NULL,

    ‘value_remember’ => false

    ); ?>

    Can you help me look into where to add and change? Thanks a lot!


  • Jack Kitterhing
    • Code Norris

    Hi there David,

    Hope you’re well today, I’ve seen what happens here, your using the available arguments for the wp_login_form

    Those are the available for

    <?php wp_login_form( $args ); ?>

    Where $args are the arguments your using, so if you wanted to use the default form with no extra arguments, you just use

    <?php wp_login_form(); ?>

    to display the login form, if that makes sense?

    Thank you!

    Kind Regards


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.