Page loading ..
The FREE Online Tips Blog Community

How to check login status in Wordpress blog

Prashant
asked
My blog runs on Wordpress. I like to play with my blog template. I am not a tech savvy guy like you but I love to customise my blog and add new features just like this blog. I will like to know how to check if I am logged in or not and show the status in the sidebar like in this blog. My blog is hosted at Blogsome.
Ramnath’s
tip
Hi Prashant and welcome to the WebTips community. You need not be a ‘tech savvy guy’ guy to continue your blogging efforts. But you know some basic things. Ok heres the tip you asked for ..

Login to your blog cpanel and go to Manage and then to Files The file you see (index.html) is the main template and this is where you operate the whole look and feel of your blog. Inside body tag just add this smarty code:

{capture name=islogin}{wp_loginout}{/capture}
{if $smarty.capture.islogin|strip_tags:'0' == "Logout"}
Logout link (/wp-login.php?action=logout)
{else}
Login link (/wp-login.php)
{/if}

From now on if you are logged in to your blog you will see the ‘logout’ link and vice versa (just like the one at the top nav bar of this site). Save your work and see the result :) Let us know if you have any further queries.


2 Comments so far

March 8, 2007
xytsun

翻译公司

May 13, 2007
Claude Gelinas

That’s not the kind of code I can come up with although it fairly easy to understand and tweak, if necessary.

Does this mean WordPress is built using Smarty templates?

July 04, 2009
You! Post your Comment ..

Post Feedbacks »


Are you a human being? Lets see .. Please type out these numbers.

For any queries mail us at: rabanerjee@gmail.com




^Back to top^

We follow creative commons 2.5 Prior permission should be taken from the admin before reproducing any part of this site.

Template by Ramnath || Free blogs at Blogsome

Powered by WordPress 1.5.1-alpha