Viewing 1 replies (of 1 total)
  • There’s a plugin or two with login box widgets (see the Mini-Meta Widget plugin). Borrowing the code from one of them and modifying that would probably be the simplest trick.

    If you want to do this from scratch, then the actual code shouldn’t be that difficult. It’s mostly setting up a simple if-else statement:

    <?php if (!is_user_logged_in()) {
    // "Hello there, Guest..." plus the form
    } else {
    // Welcome back, username. Logout.
    } ?>

    …And copying the login form from the wp-login.php file (which is in the root of a WP install). The code you’ll need is around line 430.

    You’ll have to remove some of the <p> tags, tweak the size of the form controls, and maybe change the classnames of the form controls so you can better style it.

    For the login form to work on every page, I think you’ll need to modify the action attribute from action="wp-login.php" to action="\wp-login.php" (assuming WP is installed in the root of your domain’s directory). — The slash (“\”) at the beginning of a URL is shorthand for the root directory.

    There’s also wp_loginout() which provides a simple (text) login or logout link.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding a login/registration bar at the top?’ is closed to new replies.