Support » Themes and Templates » horizontal login box

Viewing 3 replies - 1 through 3 (of 3 total)
  • Yes!

    If you go to, you’ll see a horizontal login box in the upper right corner of the screen. Here’s the code that allowed me do put it there:

    <?php global $user_ID; ?>
    <?php get_currentuserinfo(); ?>
    <?php if(! $user_ID){ ?>
    	<div id="loginbar">
    	<form name="loginform" id="menulogin" action="<?php bloginfo('wpurl'); ?>/wp-login.php?redirect_to=/main" method="post">
    		<label><?php _e('username') ?> <input type="text" name="log" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="10" tabindex="1" /></label>
    		<label><?php _e('password') ?> <input type="password" name="pwd" value="" size="10" tabindex="2" /></label>
    		<?php do_action('login_form'); ?>
    		<input type="submit" name="wp-submit" value="<?php _e('log in'); ?>" tabindex="3" />
    		<input type="hidden" name="redirect_to" value="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>main" />
    <?php } ?>

    The “loginbar” div gives you the ability to style things appropriately for your theme. I also recommend changing the “redirect-to=/main” line to whatever applies for your particular site. In this case, we’re redirecting people to a particular landing page.

    Once they are redirected to what ever page how can I want to put a welcome message with a logout link. How can I do that?

    Ruriko, that’s actually even simpler. Just put your welcome message as you normally would, and give them a link that references:

    <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout">Log Out</a>

    Anyone clicking on that link will be logged off and returned to the WordPress login screen. If you want them to be sent elsewhere, change it to the following:

    <a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=logout&redirect_to=/home">Log Out</a>

    Make sure to change /home to whatever page you want them to be redirected to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘horizontal login box’ is closed to new replies.