Twitter Button from twitbuttons.com
May 7, 2005

Batch Categories Hack

Not sure why Yahoo is sending people to this page - but here is the link if you are looking for the E_vo_lution of D_ance

Status: Installed

Batch Categories is a drop-in hack for WordPress that allows you to change the categories for groups of posts at one time, either by doing a massive ‘add category’ to all the posts that meet a search critieria or by choosing the categories to add to individual posts from a drop down list. Here is a screen shot of what it can look like.

What I like best about this is that it does not modify the ‘post_modified’ date for the post. I would like to be able to call this from an individual post so I could change the categories - or better yet find someone who could add the ‘post_modified’ date to the ‘post_edit.php’ routines so that you could check a box saying you did not want the date updated.

Because this is an old hack designed for prior versions of WordPress I found numerous posts detailing how to get it to work but most of them didn’t seem to work, or I was too dense. I am indebted to Kafkaesqui’s comments on the WP Support Board in getting this to work.

I ended up following his instructions and downloading the .91 version at http://climbtothestars.org/code/batch-categories.phps

As a side note - the easiest way to edit these files is to use the File Editor in the Admin Menu. Go to Admin | Manage | Files and it will list files that you have edited. At the bottom there is a spot where you can just type in (or paste) the file name you want to edit, like ‘wp-admin/batch-categories’ or ‘wp-admin/menu.php’.

My Mods
Near the top of ‘wp-admin/batch-categories’ I added a line to ‘menu.php’, changing this:

$title = __(’Batch Categories’);
$parent_file = ‘edit.php’;
require_once(’admin-header.php’);

to this:

$title = __(’Batch Categories’);
$parent_file = ‘edit.php’;
require_once(’admin.php’);
require_once(’admin-header.php’);

You can call the routine by typing in: http://my-site/wp-admin/batch-categories.php but I wanted it to be part of the Admin Menus so here is how I hacked it into the menu.

Then following the advice over at coldforged.org (with some modifications) I added the line:

$submenu[’edit.php’][40] = array(__(’Batch Categories’), 1, ‘batch-categories.php’);

just below the line:

$submenu[’edit.php’][30] = array(__(’Files’), 8, ‘templates.php’);

Then I went back and edited ‘wp-admin/batch-categories.php’ to remove the following lines which were no longer needed:

< ul id=”adminmenu2″>
< li>< a href=”edit.php”>< /a>< /li>
< li>< a href=”edit-comments.php”>< ?php _e(’Comments’) ?>< /a>< /li>
< li>< a href=”moderation.php”>< ?php _e(’Awaiting Moderation’) ?>< /a>< /li>
< li class=”last”>< a href=”batch-categories.php” class=”current”>< ?php _e(’Batch Categories’) ?>< /a>< /li>
< /ul>

Hopefully someone else who is searching for how to get this to work will benefit from my learning.

Navigation:

8 Comments »

  1. 1

    Hey, thanks! Updating Batch Categories has been on my to-do list for ages — your post will come in handy to me when I finally get around to doing it!

    Comment by Steph — May 13, 2005 @ 9:15 am


  2. 2

    I have a problem?The link of bach-categories is following: http://localhost/wordpress/wp-admin/edit.php?page=batch-categories.php

    It’s not the right link just like other button: http://localhost/wordpress/wp-admin/batch-categories.php

    Why? I use WordPress v1.5.1.1

    Comment by chweifly — May 24, 2005 @ 1:16 am


  3. 3

    OH! It’s strange! If I rename “batch-categories.php” to anything, it work great!

    Why?

    Comment by chweifly — May 24, 2005 @ 2:05 am


  4. 4

    I was just able to get mine working reading all the sites I mentioned after numerous failures, so I am not the person to ask for help. My suggestion is to go to the Wordpress Help Site and give as much detail as you can so that others who have seen the same error will recognize it and give you some help.

    Comment by Gary Paulson — May 24, 2005 @ 9:39 am


  5. 5

    Hey, this is great documentation. One thing to add: the second step required to get the Batch Categories button to appear on the admin bar requires changes to the file menu.php. (It’s not totally clear in your instructions).

    Thanks again..

    Comment by Jarrod Trainque — July 17, 2005 @ 11:50 am


  6. 6

    Thanks for pointing out about the missing mention of ‘menu.php’. I added it to the instructions.

    Comment by Gary Paulson — July 17, 2005 @ 10:31 pm


  7. 7

    […] Phew! Well, this is a documentation of my experience, and might not work for you. I am not a techie guy, so if you need support, please visit the following links:
    Useful information on dogberrypatch.com

    Pingback by You Got Me Blogging » WordPress Hack - Batch Categories — December 13, 2005 @ 12:09 am


  8. 8

    […] er noch nicht für Wordpress > 1.5, Tipps für die häufigen Probleme gibt´s zum Beispiel hier), für Pages hilft der PageCategoriesOrganizer. mit Category Icons lassen sich Ic […]

    Pingback by frag-den-nerd.de » Blog Archive » Categories verwalten in Wordpress :: wordpress — December 5, 2006 @ 3:34 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment



Powered by WordPress
Copyright by Gary Paulson

Bad Behavior has blocked 1037 access attempts in the last 7 days.