March 30, 2010 – 1:28 pm | No Comment

New age pundits, inspirational speakers and self-help guides have long been saying that in order to achieve success you need to understand the importance and urgency of satisfying your wants in comparison to fulfilling your …

Read the full story »
Business & Technology

Small Business, eCommerce, Marketing, New Media, Search Engine Optimization, Personal Technology

VegLife

Vegan/Vegetarian food, cooking, lifestyle, animal rights, green living.

Mind & Body

Physical health, mental health

Spirituality & Faith

Community

Community development, volunteerism, service, World, Canada, BC, Vancouver, South Asian community, Sikh community

Home » Uncategorized

WordPress 2.5/2.5.1 Post Write Panel Hack – Categories Box

Submitted by kulpreet singh on May 14, 2008 – 12:02 am16 Comments

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

16 Comments »

  • ... 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. ...

  • Baris UnverNo Gravatar says:

    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.

  • kulpreet singhNo Gravatar says:

    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.

  • danielNo Gravatar says:

    Thanks,

    Although my indenting category is getting a bit cramped with all the iframes etc….

  • kulpreet singhNo Gravatar says:

    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.

  • danielNo Gravatar says:

    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?

  • kulpreet singhNo Gravatar says:

    Hi Daniel,

    Thanks for the suggestion. I’ll add this above. :)

    -k.s.

  • PeterNo Gravatar says:

    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/

  • kulpreet singhNo Gravatar says:

    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.

  • DanielNo Gravatar says:

    oh, something I notice now… the “add category” is gone… thats not 100% handy…

  • kulpreet singhNo Gravatar says:

    Daniel, which of the above plugins / fixes did you use?

  • danielNo Gravatar says:

    …ehm Put the category selector back to the sidebar of the Post page before I kill you!?

  • Baris UnverNo Gravatar says:

    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.

  • kulpreet singhNo Gravatar says:

    Hi Daniel,

    Yup that’s the name… well it was..

    Hi Baris, thanks for the update! I will definitely check out the new version.

  • JoshNo Gravatar says:

    Hi,

    This is almost exactly what I need, but I want to turn it into a drop down box so only one category can be selected. Can you help with the modification to acheive this?

  • wqsNo Gravatar says:

    very nice article indeed

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.