Using the Thesis Theme for WordPress, there is an option to display the WordPress Admin link in your footer. This is convenient, unless you’re a single author that doesn’t really want that to show for anyone but yourself.
Here’s how you can use the Thesis Openhook plugin, and some basic WordPress functions to make sure you are the only one that sees the link.
Log into your WordPress site as an admin. Select “Thesis Options” from the sidebar.
Locate the “Display Options” section, and click the expand button next to “Administration.”
Uncheck the “Show admin link in footer” checkbox, and click the “Big Ass Save Button” (or whatever you have renamed that to).
Now, click on “Appearance” in the sidebar, then click on “Thesis OpenHook.” You’ll want to scroll all the way down… way, way down to about the bottom. Or you can use the convenient popup navigation. You’re looking for the hook called “Thesis Hook Footer.”
Enter the following code in the box (customize the url to point to your main admin link):
/*
* check if user is an admin,
* display wordpress admin link only if they're and admin
*/
<?php if( (is_user_logged_in()) && (current_user_can('install_themes')) ):?>
<p><a href="http://yourblogurl.com/wp-admin/">WP-Admin</a></p>
<?php endif;?>
Make sure you check the “Execute PHP on this hook” option. Then click your “Little Ass Save Button”
Go to your blog, and scroll to the bottom and if you’re logged in as an admin user, you should see a link for “WP-Admin” in your footer. Click that, and go to your admin dashboard and click “Logout.” Now when you view your blog, you won’t see that link at the bottom at all.
Here’s why this works:
What we’re doing is using a built-in function in WordPress to determine if someone is an admin user. But, we need a workaround since the obvious function is_admin() is reserved for the backend admin panel and dashboard area only.
Instead, we’re going to tap into the WordPress Roles and Capabilities, and use a method that simply checks if a user is allowed to do something.
WordPress uses the concept of Roles; a user has a role assigned, and that role lets the user do certain things. The roles are hierarchical in nature, and the most restricted action is “install_themes”. Only admins can do this, so if you’re wanting to check if someone is an admin, this is the perfect way to do so.
You can find a full description of what actions certain roles are allowed to perform on the WordPress Roles and Capabilities page.
So, only if you are an actual admin will the WP-Admin link display to you.
{ 6 comments }
Great plugin! I will try it on some blogs I have. It would be great if it could be able to create more than one list. I will try to integrate it sloppy with paypal, but it would be nice to have an official version of the plugin with paypal, right? Thanks
Thanks. Will look into it.
Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!…..I”ll be checking in on a regularly now….Keep up the good work!
- Marc Shaw
I don‘t know If I said it already but …Cool site, love the info. I do a lot of research online on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,
…..Frank Scurley
Hey, I found your blog while searching on Google. I have a blog on online stock trading, I’ll bookmark your site.
Great plugin! Been looking for something like this for ages.
I’m always amazed how you can so easily write your message
Comments on this entry are closed.