Effutio Forum
Contact Effutio
About Effutio Author
buzz_button

As you can see I use a sidebar login for here on Effutio.com that completely bypasses the standard Wordpress 2.8 login screen page. No big deal you may be thinking but it is one less page that users have to wait to load, it adds a professional look and encourages people to login.

OK now that you are convinced that being able to login from home page (or any page where the code is placed) I’ll show you how to achieve it. Ive placed my login form at the top of the sidebar but feel free to experiment putting it elsewhere (maybe the header).

So we need to create a form that captures and the users login details, here is mine:

Insert this form code into your sidebar code probably between some <li> tags and hey presto you have a login form that allows users to login directly from the page. You will also see a checkbox allowing users to stay logged in too just like the standard Wordpress login page (so we dont lose any functionality).

Lets expand on the above form by adding the option for users to register and recover their password if forgotten! These two lines of code do the job:

  • Register
  • Recover password
  • Excellent now it looks really professional and has everything we need…….or does it. What about logging out I hear you cry! Yeh it would be cool if the option to logout only appeared if the user was already logged in! Well I’ll show you how to do that too. So how do we say ‘if the user is not logged in show the the login form and if not show the alternative menu with logout option’? Like this:

    
    

    Login

    Control Panel

    You can see that I display a control panel menu when the login form is not displayed. This code is taken directly from my sidebar.php file and of course you will probably have to adapt it slightly to fit your own theme.

    This code is designed to work with Wordpress 2.8+, it wont work in previous versions.

    You can take this hidden menu further and I do in my next tutorial here

    Join the forum discussion on this post

    • Share/Bookmark

    2 Responses to “Login directly from a page in Wordpress using a sidebar login form”

    1. December 21, 2009 at 4:00 pm

      Two wrong with this:

      1, What should be logged in to see the non-logged in to see
      2, is not good for the logout link

    2. Neil December 21, 2009 at 4:44 pm

      Erm… two things wrong with your comment

      1. Non-logged in users see a login screen:
      < ?php if ( ! is_user_logged_in() ){ ?> translated: If user is NOT logged in display following!!

      2. This is good for logout if you use Wordpress 2.7+, I can only think you run an older version of WP

    Leave a Reply

    Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Rss Feed Tweeter button Facebook button Technorati button Reddit button Myspace button Linkedin button Webonews button Delicious button Digg button Flickr button Stumbleupon button Newsvine button

    Switch to our mobile site

    Web Design - Web Host