Matt Read, The Weblog

Abusing monkeys since 2003

Main Navigation


WordPress Admin Bar Plugin vo.5

Monday, September 13th 2004

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.

Download and License

See the box below for download and license information.


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.

  1. Comment by Palindrome

    %2005-01-04T18:54:44-05:00 %EST

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

  2. Comment by Adam

    %2005-01-12T13:45:40-05:00 %EST

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

  3. Comment by muchacho loco

    %2005-02-09T13:34:10-05:00 %EST

    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

  4. Comment by John Hesch » Creating My Personal Information Manager Using WordPress Part III § johnhesch.com

    %2005-02-10T03:42:44-05:00 %EST

    [...] ts are automatically created for me. The last thing I did this evening was to install the Admin Bar plugin. This is a must have for every WordPress installation. The plu [...]

  5. Comment by Alejandro

    %2005-02-11T12:46:29-05:00 %EST

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

  6. Comment by Matt Read

    %2005-02-11T16:53:19-05:00 %EST

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

  7. Comment by Alejandro

    %2005-02-13T12:28:02-05:00 %EST

    Great, now it works. Really helpful ;)

  8. Comment by Alejandro

    %2005-02-15T20:58:49-05:00 %EST

    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

  9. Comment by Alejandro

    %2005-02-15T21:26:58-05:00 %EST

    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!)

  10. Comment by Joe Edmon

    %2005-02-18T05:03:06-05:00 %EST

    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 (functionexists('adminbar')) admin_bar(); ?>

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

  11. Comment by http://angel.knigh7s.net/index.php?p=34

    %2005-02-19T02:24:49-05:00 %EST

    [...] of the idea that life is serious. 2/18/2005 Things to update site with Admin Toolbar - http://www.mattread.com/archives/2004/09/wp-admin-bar/    Filed under: General — Knigh7s @ 2024 [...]

  12. Comment by Matt Read

    %2005-02-19T04:18:40-05:00 %EST

    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.

  13. Comment by Collin

    %2005-02-24T00:27:21-05:00 %EST

    I'll probably have to update my version when you release the new one, but I made my copy have dropdowns for each section, just like the different areas in wp-admin:

    http://collingrady.com/wp-content/admin-bar/admin-bar.gif

  14. Comment by Sean Langlands

    %2005-02-24T02:04:42-05:00 %EST

    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. : )

  15. Comment by Josiah

    %2005-03-04T03:42:04-05:00 %EST

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

  16. Comment by The Listless Lawyer » Installing Wordpress 1.5 plugins

    %2005-03-07T21:54:58-05:00 %EST

    [...] e same thing for nicetitle.js, on the next line down. Next up: You really should get the Admin Bar plugin. This one works with 1.5 out of the box, and it makes working with your weblo [...]

  17. Comment by Josiah

    %2005-03-08T22:19:21-05:00 %EST

    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.

  18. Comment by Wholly His » Josiah Digest: Where Have I Been?

    %2005-03-09T02:07:28-05:00 %EST

    [...] you say? Good, then I did it well. Basically, my objectives were twofold: to restore an administrative plugin that had been in use by Stephen and I before the upgrade to WordPress 1. [...]

  19. Comment by wrap.yourtrap.com » Blog Archive » WordPress Admin Bar plugin

    %2005-05-19T18:37:18-04:00 %EDT

    [...] nly add this bar for users that are logged in and have a user level equal to, or above 1. Get the WordPress Admin Bar plugin

    [...]

  20. Comment by Joseph Becher

    %2005-07-17T18:47:09-04:00 %EDT

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

  21. Comment by Anonymous

    %2005-08-01T10:21:33-04:00 %EDT

    lol

  22. Comment by jheremy

    %2005-12-11T05:10:02-05:00 %EST

    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.

  23. Comment by pete watch

    %2006-04-22T19:22:44-04:00 %EDT

    Update would really appreciated, thanks for your work anyway hahahah

  24. Comment by Work From Home

    %2006-05-23T08:41:26-04:00 %EDT

    Second that, an update would be awesome. Cheers ;)

  25. Comment by imysdi7@mail.ru

    %2006-07-17T15:33:29-04:00 %EDT

    funny ringtones

  26. Comment by Anonymous

    %2006-08-27T22:17:05-04:00 %EDT

    I meet it,I find it.

  27. Comment by Kameron

    %2006-12-12T18:40:19-05:00 %EST

    What I want to do on my blog, is every few hours take the oldest post and move it to the front of the queue, all automatically. Anyone know if there is a plugin that can do this or a simple way to set up another plugin to do this (use my own feed perhaps)? Thanks.


Leave a Comment

Before leaving a comment, please ensure you have read and understand my comments policy and my privacy policy. Any comment that does not abide by the comment policy will be deleted immediately.

Your Information (required)