WordPress 2.5/2.5.1 Post Write Panel Hack - Categories Box
Hi Everyone,
— read the updates below —
If you’re using WordPress 2.5.1, and you don’t like the Categories box being underneath the post write box, and you want the box back in the sidebar, this is for you!
Screenshot:

—-
Before you start, backup your wp-admin/edit-form-advanced.php file.
After backing it up, locate the file and open it in your code/text editor and follow these steps:
Step 1) Find and delete this:
<div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>"> <h3><?php _e('Categories') ?></h3> <div class="inside"> <div id="category-adder" class="wp-hidden-children"> <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> <p id="category-add" class="wp-hidden-child"> <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> <input type="button" id="category-add-sumbit" class="add:categorychecklist:categorydiv button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> <span id="category-ajax-response"></span> </p> </div> <ul id="category-tabs"> <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li> <li class="wp-no-js-hidden"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li> </ul> <div id="categories-all" class="ui-tabs-panel"> <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> <?php dropdown_categories(); ?> </ul> </div> <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > <?php wp_popular_terms_checklist('category'); ?> </ul> </div> </div> </div>
Step 2) Find and delete this:
<div class="side-info"> <h5><?php _e('Related') ?></h5> <ul> <?php if ($post_ID): ?> <li><a href="edit.php?p=<?php echo $post_ID ?>"><?php _e('See Comments on this Post') ?></a></li> <?php endif; ?> <li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li> <li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li> <li><a href="categories.php"><?php _e('Manage All Categories') ?></a></li> <li><a href="edit-tags.php"><?php _e('Manage All Tags') ?></a></li> <li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li> <?php do_action('post_relatedlinks_list'); ?> </ul> </div>
Step 3) Find this (Don’t delete it - just find it):
<span id="autosave"></span> </p>
Step 4) Paste this underneath:
<div class="side-info" style="margin-left: -15px; "> <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>" style="width: 260px;"> <h3>Categories</h3> <div class="inside"> <div id="category-adder" class="wp-hidden-children" style="margin-left: -5px; "> <h4> <a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> <p id="category-add" class="wp-hidden-child" style="width: 250px; " > <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" style="width: 150px; " /><br /> <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> <input type="button" id="category-add-sumbit" class="add:categorychecklist:categorydiv button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> <span id="category-ajax-response"></span> </p> </div> <ul id="category-tabs" style="width: 2px; "> </ul> <div id="categories-all" class="ui-tabs-panel" style="height: 400px; margin: 2px; "> <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> <?php dropdown_categories(); ?> </ul> </div> </div> </div> </div>
Step 5) Save (make sure your old copy was backed up).
Step 6) Login to your WP Admin and go to “Write > Post” and check it out. If you like it let me know that it worked. If not, I cannot provide support but you can still contact me at info [at] kulpreetsingh [dot] com.
Disclaimer:
This has been tested on WP 2.5.1. I am not responsible for your WP installation or for this fix. Please backup your edit-form-advanced.php file and restore it if this doesn’t work.
—-
Update:
Screencast by Rebecca Bollwitt (Miss604) on how to do the above:
—-
Update 2:
It turns out there’s a plugin that does this as well! Probably easier to manage for the non-coding population, especially because it will / should extend regardless of your version updates. It is a little different from my method, but the concept is the same. The website’s in Turkish but the plugin page is in English: http://beyn.org/sidecat/
—-
Update 3:
Peter Keung took this fix and the plugin above and made a new plugin. Thank you Peter! You can download it here: http://www.theblog.ca/wp-content/uploads/2008/05/sidecat_reloaded.txt
Comments & Trackbacks
Follow the Comments on This Post
This entry was posted on Wednesday, May 14th, 2008 at 12:02 am under: Knowledge.

May 14th, 2008 14:39
... I cried out on Twitter this morning about how I’m not too keen on the new placement of the Categories box in the latest version of WordPress. Kulpreet Singh (who presented at WordCamp) came to the rescue with his hack to the edit-form-advanced.php, posted here. ...
May 14th, 2008 15:22
New version coming up, remember to check the page in 3 days :). This version lets you edit the existing post’s categories - this one doesn’t.
May 14th, 2008 16:23
Hi Baris,
Thanks for your comment! I will check out your plugin in 3 days and try it out! So just to confirm - your plugin will do everything I’ve shown above, and it should work with future versions of WP, right?
thanks
-k.s.
May 17th, 2008 13:27
Thanks,
Although my indenting category is getting a bit cramped with all the iframes etc….
May 17th, 2008 14:29
Hi Daniel,
Are you using my fix, Baris’ plugin, or Peter’s plugin? Props to Peter & Baris but I tried the plugins and I like the layout of the categories box in my fix a little more… I just don’t know how to make it into a plugin.
May 18th, 2008 02:11
Hi Kulpreet
First I used Peters, on which I complained, and now I have Baris’ which seems okay to me.
Your description on how to change the php script was a bit too scary for me. Why don’t you just offer the alternate edit-form-advanced.php instead?
May 18th, 2008 13:40
Hi Daniel,
Thanks for the suggestion. I’ll add this above. :)
-k.s.
May 19th, 2008 22:13
Here it is again, fully Kulpreet-style:
http://www.theblog.ca/wp-content/uploads/2008/05/sidecat_reloaded_ks.txt
I’m not as big of a fan of the fully expanded version (which should be what this is) because the divs below the posts have a gap if your post box isn’t that big. Uh, hard to explain but if you’ve seen it, you’ll know what I mean.
Side note: do you think there’s enough activity for a Planet WordPress, Canadian version? I find this one quite useful (not the same as the official wordpress.org one) but a Canadian one might help support the Vancouver and Canadian community even more:
http://planetwordpress.planetozh.com/
May 20th, 2008 10:40
Thanks so much Peter! I don’t know if there’s enough activity but I definitely think it would be cool to have a Canadian version.
May 22nd, 2008 09:29
oh, something I notice now… the “add category” is gone… thats not 100% handy…
May 22nd, 2008 10:01
Daniel, which of the above plugins / fixes did you use?
May 24th, 2008 13:26
…ehm Put the category selector back to the sidebar of the Post page before I kill you!?
May 25th, 2008 12:34
Hi there! I updated the plugin (new name: Category Selector Back to the Sidebar) with the help of Jeremy Clarke. You can visit the same link you published to download the new version.
May 26th, 2008 18:25
Hi Daniel,
Yup that’s the name… well it was..
Hi Baris, thanks for the update! I will definitely check out the new version.