The Ultimate Tag Warrior is probably one of the best plugin out there for WordPress. It is a powerfull and complex plugin, with lots of template tags. You can customize these template tags too, but do looks rather complicated and confusing to do.
Here are some ideas from aoina, a one of the WordPress user in Japan.
Display 10 most popular tags, with feed icons
This will output the feed icons infront of each tag. Just like the similar feature for the categories.
[php]
‘
- %tagdisplay%(%tagcount%)
‘), 10); ?>
[/php]
Display ‘+’ infront of tags, when tag archive
I love this one. Just what I wanted. It’s easier to see, than to explain. If you click ‘plugin’, it will return the entries tagged ‘plugin’. But if you click ‘+’ infront of ‘plugin’, it will return the entries tagged with ‘wordpress’ AND ‘plugin’.
There is a similar ajax-powered feature which comes with UTW, but this is much simpler and lighter, I think.
Here is the code I use in tag.php
. I display it slightly different, compared to how Aoina.com do.
[php]
‘%intersectionlink% %tagdisplay%(%tagcount%)’,
‘default’ => ‘%intersectionlink% %tagdisplay%(%tagcount%), ‘,
‘last’ => ‘%intersectionlink% %tagdisplay%(%tagcount%)’
)); ?>
[/php]
These two customization uses $format
for custom formatting.
Add the tag name in the TITLE of the tag archive
When you display an archive for a tag, only your blog title is displayd in the title. For SEO, it would be better to display the tag name here. T the bottom of ultimate-tag-warrior-actions.php
, add this code:
[php]
add_filter(‘wp_title’, ‘utw_blogtitle’,1);
function utw_blogtitle($title){
if(get_query_var(“tag”) && !$title) return ” » ” . get_query_var(“tag”);
}
[/php]
This actually didn’t work for me, as I use the Optimal Title plugin. So instead, I edited optimal-title.php
. Near the end, between if ($single) { ... }
and if ($display && isset($title)) { ... }
.
[php]
if(get_query_var(“tag”) && !$title) {
$title = get_query_var(“tag”) . “$sep Tag Archive”;
}
[/php]
Fix the bug when used with WP-PageNavi
Like me, if you use WP-PageNavi, there is a bug when an archive of two or more tag is displayed. If ‘wordpress’ tag has 5 entries, and ‘plugin’ tag has 3, ‘wordpress+plugin’ should return total of 3 entries. But WP-PageNavi returns 8 entries.
Edit the lines 37 to 39 of pagenavi.php
, from:
[php]
preg_match(‘#FROMs(.*)sGROUP BY#siU’, $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var(“SELECT COUNT(DISTINCT ID) FROM $fromwhere”);
[/php]
to this:
[php]
if( strpos(get_query_var(‘tag’), ” “) ){
preg_match(‘#^(.*)sLIMIT#siU’, $request, $matches);
$fromwhere = $matches[1];
$results = $wpdb->get_results($fromwhere);
$numposts = count($results);
} else {
preg_match(‘#FROMs(.*)sGROUP BY#siU’, $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var(“SELECT COUNT(DISTINCT ID) FROM $fromwhere”);
}
[/php]
[These tips are by AOINA.COM]