WordPress Dashboard Editor

Of the entire website the Dashboard is seen by administrators the most, but it is the hardest part of WordPress to customize. Well not anymore. This plugin allows you to add whatever you want to the Dashboard through PHP and HTML and allows you to even add Sidebar Widgets. You may also wipe the entire dashboard or individually remove some of the more irritating sections like the Dev news, Planet WordPress and the getting started section.

In WordPress 2.5, the code is cleaner, the plugin is more responsive and you can add both “real” sidebar widgets, or add “fake” ones to match the dashboard.

This plugin is currently intended for 2.5, but it also works in WordPress 2.1 – 2.3 and can work in WordPress 2.0.x if you use the Completely Wipe Dashboard option.

Installation is a breeze:

  1. Download the zip file for WordPress Dashboard Editor
  2. Unzip and upload dashboard.php to your wp-content/plugins/ folder.
  3. Go to your dashboard. There will be a new sub-menu item.
  4. Select any options you want and add any PHP or HTML code that you want to the textbox.

Code Examples:

To add a sidebar widget to your dashboard (after selecting the option from the Dashboard management page) use the code:
<?php dynamic_sidebar('admin');?>
The Admin sidebar is modified and controlled the exact same way as any other sidebar.

If you use the WP-UserOnline plugin you can use:
<?php echo useronline_page();?>

In WordPress 2.1-2.3 f you find that your new content doesn’t align nicely you can add:

<div style="float:left; width:460px;">
//Add all other content here

Any code that can be used in your WordPress Theme can be used in the dashboard. This means that you can have different information appear for the different user roles among other things.

Custom Category Templates on a Archive or Index page.

On my home page and in my archives, I use a custom category template to display asides and news articles. This is very easy to do and it only takes a couple seconds of work to create custom category templates in any WordPress theme.

The first step is to add the following to your current theme’s index.php loop after the line that looks like <?php while (have_posts()) : the_post(); ?>, but before any other code.

<?php $cat_temp = cat_loop();?>
	<?php if($cat_temp && is_numeric($cat_temp)){?>
		<?php include('loops/cat_'.$cat_temp.'.php');?>
	<?php }else{ ?>

Then add } just before the line endwhile.

The next step is to add the following to your theme’s functions.php file (you may have to create a file with the same name):

function cat_loop(){
	global $blog_id,$post, $wp_version;
		if($wp_version >= 2.3){
			global $object_term_cache;
			$array = $object_term_cache[$blog_id][$post->ID]['category'];
			global $category_cache;
			$array = $category_cache[$blog_id][$post->ID];
		while (list($cat) = each($array)) {
				return $cat;

This can be modified to look at author’s also. Now the only thing you have to do is to create a folder named “loops” in your theme’s folder, and then create a new file with a new “loop” — excluding the while and endwhile parts — and name it cat_xxx.php where xxx is the id of the category the loops is for.

This can be repeated for single.php, archive.php, or anywhere else a custom loop is useful. You can even use something similar for individual posts or pages.

A post may be in multiple categories, but it will only use the first custom template it finds, so make sure the post is in only one specially styled category at a time.

Organizing WordPress Plugin Bug Reports.

One of the downsides of having a popular plugin is the amount of support requests, bug reports, and feature suggestions that come in. Well, it’s not that bad, but sometimes it’s difficult to organize what features should be added, what bugs must be tackled first, and what can just be ignored.

If you’re one of the few and the proud over at WP Extend Plugins, you have a nice tool at your disposal to keep track of all your plugin related needs. The tool, you ask? It’s the trac ticketing system over at the WordPress Plugin Repository.

From Weblog Tools Collection

For most of my wordpress plugins, like AJAXed WordPress I use SVN and the WordPress Plugin Repository to keep track of changes I make to my plugins between versions to make it easier to write the changelog, but I never considered using it for bug reports.

It would make it so much easier because I have a tendency to get bug reports and feature requests in emails, comments on the extend page, in forums, on the main plugin page, on its readme page. It gets so chaotic that stuff slips through all the time.

I’m on the verge of writing a Plugin to help me organize it all. ;)

Displaying WordPress categories in a horizontal dropdown menu.

One of my readers recently asked how I created my horizontal menu bar: the short answer is by mixing CSS and Javascript.

The first step is to get WordPress to display the menu as a hierarchical list without a title. <?php wp_list_categories('sort_column=name&sort_order=asc&style=list&children=true&hierarchical=true&title_li=0'); ?>

We then wrap this WordPress code in the following so we can style it.

<div style="text-align:center;">
    <ul id="menu" style="padding:0; margin:0;">
        <?php wp_list_categories('sort_column=name&sort_order=asc&style=list&children=true&hierarchical=true&title_li=0'); ?>

I added this to my header.php, but you can add it anywhere you want it to appear.

The CSS is fairly simple and you just need to add it to your theme’s style.css file.

ul#menu {
	margin: 0;
	padding: 0;
	list-style: none;
	width: 100%;

ul#menu li {
	float: left;
	padding: 0;
	margin: 0;
	border-right:solid 1px #fff;

ul#menu ul li {
	float: none;
	position: relative;
	border-bottom: 1px solid #7EAED7; /* fixes gap problem in IE */
	border-left: 1px solid #FFF;

ul#menu li ul {
	margin: 0;
	padding: 0;
	list-style: none;
	position: absolute;
	background: #9CC;
ul#menu ul ul{
	margin-left: .2em;
	position: absolute;
	top: 0; /* if using borders, -1px to align top borders */
	left: 100%;

ul#menu * a:hover, ul#menu li a:active{
background:#7EAED7 !important;
color: #FFFFFF;

ul#menu li a:link,
ul#menu li a:visited,
ul#menu li a:hover,
ul#menu  li a:active{
	display: block;
	padding: .2em .3em;
	text-decoration: none;
	background: #5587B3;
	 color: #FFFFFF;

ul#menu ul li a:link,
ul#menu ul li a:visited,
ul#menu ul li a:hover,
ul#menu ul li a:active {
	width: 8em;

Of course you will need to change the colors and text sizes to ensure it blends with the rest of the theme.

Now the last step is the to make it work as a drop-down list on all browsers. This could be done in Firefox with a simple CSS declaration, but Internet Explorer doesn’t understand the :hover pseudo classes, so we mimic this in Javascript.

<script type="text/javascript">

var mbA,mbT,mbTf,mbSf;
var mbR = [];

function mbSet(m) {
if (document.getElementById&&document.createElement) {
	var m=document.getElementById(m);
	mbR[mbR.length] = m;
	var i;

	if (!mbTf) mbTf=new Function('mbHT();');
	if (!mbSf) mbSf=new Function('mbS(this);');
	for (i=0;i<e.length;i++) {

	for (i=0;i<m.length;i++) {

function mbHA() {
	if (mbA) {
		while (mbA) mbH(mbA);

function mbHT() {
	if (!mbT) mbT=setTimeout('mbHA();', 0);

function mbTC() {
	if (mbT) {

function mbS(m) {
	if (mbA) while (mbA&&m!=mbA&&mbP(m)!=mbA) mbH(mbA);
	else mbHE('none');

	if (mbM(m)) {

function mbH(m) {
	if (m==mbA) mbA=mbP(m);

function mbL(m) {
	while (m && m.tagName != 'A') m = m.previousSibling;
	return m;

function mbM(l) {
	while (l && l.tagName != 'UL') l = l.nextSibling;
	return l;

function mbP(m) {
	var p = m.parentNode.parentNode;
	if (p.tagName == 'UL') {
		var i = 0;
		while (i < mbR.length) {
			if (mbR[i] == p) return null;
	} else {
		return null;
	return mbL(p);

function mbSH(m,v) {

function mbHE(v) {

function mbHEV(v,e) {
	for (var i=0;i<e.length;i++) e[i].style.display=v;

A couple notes on the previous code.

  1. To activate it, change your theme’s <body> tag to <body onload=”mbSet(‘menu’);>
  2. It was not written by me, but I’ve been using it for a long time and don’t remember where I got it.
  3. It can occasionally create a JavaScript error, and I’ve intended to rewrite it for a long time, but it usually works fine.

Tag Management for WordPress 2.3

Now that you have gotten used to WP 2.3 and had time to fiddle around with all those tags, you are probably finding that you need to edit, rename or delete tags. While I was going to write my own Plugins for this for a while, I found the perfect Plugins to do the work for me — and by perfect I mean really good, so I take no responsibility if they eat your dog.

The Simple Tags has been around for a long time, but now it works perfectly with WordPress tagging. What does it do? Most everything you could want (I could retype the list, but I’m going to borrow it straight from the Simple Tags website):

  • type-ahead input tags
  • auto suggestion of tags
  • tags management (rename, delete, amalgamate, search and add tags, edit tags ID)
  • List of non tagged contents
  • Edit mass tags
  • Possibility to tag pages (not only posts) and include them inside the tags results
  • Related content since common tags
  • Possibility to add related posts inside RSS
  • Dynamic Tag Clouds with colors with Widgets
  • Tags inside your header’s blog
  • Embedded tags ([tags]tag1, tag2[/tags]) for retro compatibility

I use a lot of Plugins and write a lot of Plugins, so the fact that I even use one usually means it is really well made or very useful, but this one is one of the very few that I thought was good enough to promote. Remember, if you have a favorite Plugin, do the author a favor and mention it once or twice.

Oh and what would be really nice is if it had a feature that would suggest related keywords based on the text (there used to be a Yahoo API that did this.) Wink Wink.

Mysql Search and Replace.

I’ve been getting ready for WordPress 2.3, so in preparation I’ve started cleaning up my database. My first order of business was to clean up the tags database. Over time I’ve used several different methods of separating words: all spaces, hyphens and underscores have all been used which really makes the nice names ugly. Fixing this was easy, I just used the MYSQL replace command:

UPDATE `table` SET `field` = REPLACE(Field,'change_me','to_me');

Or specifically for the tags:

UPDATE `wp_tags` SET `tag` = REPLACE(tag,'_',' ');