Fix 404 errors on Ultimate Tag Warrior

I uses Ultimate Tag Warrior version 3.14159265 (February 4th, 2007) with WordPress 2.1, it work great but there have some problem or bug that when you try to open /tag it will show 404 errors. I check and try to make the page /tag or /tag/ show all tags with function of Ultimate Tag Warrior. Here is small changed.

PHP:
  1. function ultimate_tag_templates() {
  2.     if ($_GET["archive"] == "tag") {
  3.         include(TEMPLATEPATH . '/tag_all.php');
  4.         exit;
  5.     } else  if (get_query_var("tag") != "") {
  6.         ultimate_get_posts();
  7.  
  8.         if (is_feed()) {
  9.  
  10.             return;
  11.         }
  12.         if (file_exists(TEMPLATEPATH . "/tag.php")) {
  13.             if ( $_GET["feed"] == '') {
  14.                 include(TEMPLATEPATH . '/tag.php');
  15.                 exit;
  16.             }
  17.         } else {
  18.     //    include(TEMPLATEPATH . '/index.php');
  19.         }
  20.     }
  21. }

This function will process when you query for tag but you will see if you request with empty value of tag it won’t process anything and let Wordpress process this and finally it give 404 errors

I just made some changes to handle when user query with empty tag or open at /tag or /tag/

PHP:
  1. function ultimate_tag_templates() {
  2.     if ($_GET["archive"] == "tag") {
  3.         include(TEMPLATEPATH . '/tag_all.php');
  4.         exit;
  5.     } else  if (get_query_var("tag") != "") {
  6.         ultimate_get_posts();
  7.  
  8.         if (is_feed()) {
  9.  
  10.             return;
  11.         }
  12.         if (file_exists(TEMPLATEPATH . "/tag.php")) {
  13.             if ( $_GET["feed"] == '') {
  14.                 include(TEMPLATEPATH . '/tag.php');
  15.                 exit;
  16.             }
  17.         } else {
  18.     //    include(TEMPLATEPATH . '/index.php');
  19.         } else    {  
  20.         if ( (eregi('^/tag$', $_SERVER['REQUEST_URI']) ) ||
  21. (eregi("^/tag/$", $_SERVER['REQUEST_URI'])) ) {  
  22.         include(TEMPLATEPATH . '/tags.php');
  23.         exit;
  24.         }
  25.     }
  26. }

You may need to have file tags.php in your theme directory

Here is example of tags.php

PHP:
  1. <?php get_header(); ?>
  2.  
  3. <div class="primary">
  4.  
  5.     <?php UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud","",0) ?>
  6.  
  7. </div>
  8.  
  9. <?php get_sidebar(); ?>
  10.  
  11. <?php get_footer(); ?>

You also can change function or parameters to display tag in the page as you want. Please see all detail here UltimateTagWarrior help



One Response to “Fix 404 errors on Ultimate Tag Warrior”

  1. Thai Healthcare and dental care Says:

    Another Day, Another Post…

    […] While surfing aimlessly today I came across this site: […]…

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>