WordPress Admin Bar Plugin vo.5

This plugin will add a bar at the top of your template file with links to the admin sections of WordPress. However it will only add this bar for users that are logged in and have a user level equal to, or above 1.

Note: Version 2 of this plugin is now available for WordPress 1.5. For WordPress 1.2 use this version.

Installation

To install the script just unpack the archive (link below) and upload the file admin-bar.php to the plugins folder. Then activate the plugin in the admin area. Then add the following code JUST AFTER THE <body> tag in your template (index.php):

<?php admin_bar(); ?>

That’s it, easy isn’t? Damn, WordPress is good.

Actually, that’s not quite it. If you have removed the wp_head(); function from the <head> of your XHTML, then read read the following Style Sheet section, if not skip the Style Sheet section.

Style Sheet

To get the admin bar to display properly, I have added some CSS to the plugin. If you have removed the wp_head(); function from the <head> however, the CSS won’t be added. So you will have to add it yourself. The admin bar is contained in a list, <ul> and has the id #admin. So you could write your own CSS or use, or modify, the following default CSS:

#admin {
z-index: 20;
width: 100%;
margin: 0;
background: #666;
border-bottom: 2px solid #fff;
color: #fff;
font-size: 12px;
font-family: verdana, sans-serif;
text-align: center;
}
 
#admin li {
display: inline;
padding: 5px;
}
 
#admin li a {
color: #eee;
text-decoration: none;
letter-spacing: 1px;
}
 
#admin li a:hover {
color: #bbb;
text-decoration: none;
}

And after adding that CSS your done and ready to use the plugin. Have fun.

Features

The following is a list of links shown for the different user levels.

  • level 10: Write, Edit, Links, Users, Profile, Options and Admin Area
  • level 5: Write, Edit, Links, Users, Profile and Admin Area
  • level 4: Write, Edit, Users, Profile and Admin Area
  • level 1: Write, Edit, Profile and Admin Area

When you are view a single post the “Edit” link will appear as “Edit This Post” and take you to the edit section for that post. “Admin Area” is just a link to the default section, Write.

Future Plans

I’m thinking that I will add a link to the Categories admin, and when your are viewing posts in a category, link to the edit category. I’m also thinking of adding a notice for when new comments have been made.

If you have any ideas for the admin bar please leave a comment below. Thanks.

WordPress Admin Bar Plugin vo.5 was written by

Comments

The opinions expressed in comments are entirely the responsibility of the various contributors. While I will do everything within reason to ensure that they are not defamatory, I accept no liability for them or the content of links included in them.

(#1668)

Very useful plugin. Thanks sir! Link from my site to yours is the only payback I can currently offer.

(#1673)

Ditto!!! Great Plugin !! Awesome work my friend…

(#1697)

may I ask you which is the code that I should add just after the tag. because I ca´’t make this plugin work because I don’t know what should I do next. please help me. thanx

(#1690)

What is the code I have to add? there is nothing there :S Saludos

(#1691)

Sorry about that guys, I re-added the code you need to add. Should make sense now.

(#1698)

Great, now it works. Really helpful ;)

(#1708)

Hi!, its me again :P I just upgraded to 1.5 and I’m using the default theme and the adminbar doesn’t fit in there. I wanted to let you know that as 1.5 is now official hahahah Saludos Alejandro

(#1726)

sorry, but I made it look better hahahah to put it in the header.php file of the current theme hehe PS: How did you get the “preview” plugin?, is really cool!)

(#1712)

Very cool. We’re using WP1.5, so I installed the line of code into the header file and it worked fine. I also modified the code to:

<?php if (function_exists(‘admin_bar’)) admin_bar(); ?>

This will prevent an error if we ever deactivate the plug-in

(#1719)

Joe Edmond, yeah, that’s a good idea. I usually do that with all my plugin template functions. Also, the next Version of Admin Bar will soon be out hahahah just a heads up.

(#1722)

Very Nice. Great Job man!

I will be using this for my new version of my site. Keep a look out for it and I will mention your site too. : )

(#1728)

Will you be releasing an updated version for 1.5? I loved it on 1.2!

(#1733)

In the menu array section of your plugin, what does the number represent? I see write is “1”, links is “5”, users “3”, etc.

Thanks.

(#2053)

Can’t find the download file, is the link broken?

(#2154)

ok im serously confused i added the code after dleing the wp_head (); but i cant finr were to put the css code, and i dont know which file to put the whole thing in i cant figure out were it goes admin wide. anyway its probobly my own stupidity, but i would really appriciate it if you could help me figure this out.

(#2357)

Update would really appreciated, thanks for your work anyway hahahah

(#2590)

I meet it,I find it.

Related Posts