I wanted to update my Archives page to display the total tag count, but didn’t see a built-in method in Ultimate Tag Warrior to do that. So, here’s the recipe I followed - mimicking how the other methods are set up, in case the changes get rolled into the main distro…

In ultimate-tag-warrior.php:

	function UTW_ShowUniqueTagCount() {
		global $utw;

		echo $utw->GetUniqueTagCount();
	}

In ultimate-tag-warrior-core.php:

	function GetUniqueTagCount() {
		global $wpdb, $tabletags;

		$sql = "select count(*) from $tabletags";
		return $wpdb->get_var($sql);
	}

And, in K2’s page-archives.php (or anywhere you want the count to show up):

	 tags

I’ve also hacked my copy of wp-db-backup.php to automatically back up the UTW tables, thusly, starting at line 407:

$wp_backup_default_tables = array ($table_prefix . categories,
	$table_prefix . comments,
	$table_prefix . linkcategories,
	$table_prefix . links,
	$table_prefix . options,
	$table_prefix . post2cat,
	$table_prefix . postmeta,
	$table_prefix . posts,
	$table_prefix . users,
	$table_prefix . tags,
	$table_prefix . post2tag,
	$table_prefix . tag_synonyms);

Comments

One Response to “Ultimate Tag Warrior hack: counting tags and backing up”

  1. Kefka’s Tower » Blog Archive » WebObjects on November 24th, 2005 12:15 am

    [...] I’m researching servlet based deployment with WebObjects 5.3.1 and unfortunately the matter doesn’t seem to be as straight forward as it should be. Best links I’ve found so far are this and this. [...]

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 Canada License.