Ultimate Tag Warrior hack: counting tags and backing up

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);

Last updated: November 23, 2005