Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Thanked 0 Times in 0 Posts

    Login box in Wordpress header.php

    I'm trying to add a login box to my header. I picked up some code (below) from Wordpress.org support and placed it in the header.php file and got a messy result - http://i49.tinypic.com/wsmlaa.png - the clickable part wrapped around to the next line and aligned left. I'd appreciate any help. Thanks. Something as small as the login box on this forum would be marvelous. Cheers!

    <div align="right">

    <?php global $user_ID, $user_identity, $user_level ?>
    <?php if ( $user_ID ) : ?>
    <h2>Control panel</h2>
    <li>Identified as <strong><?php echo $user_identity ?></strong>.
    <li><a href="<?php bloginfo('url') ?>/wp-admin/">Dashboard</a></li>

    <?php if ( $user_level >= 1 ) : ?>
    <li><a href="<?php bloginfo('url') ?>/wp-admin/post-new.php">Write an article</a></li>
    <?php endif // $user_level >= 1 ?>

    <li><a href="<?php bloginfo('url') ?>/wp-admin/profile.php">Profile and personal options</a></li>
    <li><a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">Exit</a></li>

    <?php elseif ( get_option('users_can_register') ) : ?>

    <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
    <label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /> User</label><br />
    <label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> Password</label><br />
    <input type="submit" name="submit" value="Send" class="button" />
    <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>

    <li><a href="<?php bloginfo('url') ?>/wp-register.php">Register</a></li>
    <li><a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Recover password</a></li>

    <?php endif // get_option('users_can_register') ?>

    </li> [CODE]
    Last edited by dtzfilms; 07-31-2012 at 12:27 AM.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts