Updating from Categories to Tags in WordPress
I updated my WordPress installation to the version 2.3.x and found a new feature: tags.
I converted all my categories to tags (except the Uncategorized category) and… what I saw a small disaster :) All categories disappeared (an expected result), but the categories list in my sidebar contained only one, not very useful, item Uncategorized. Additionally a blog entry contained only Filed under: Uncategorized, again, not very helpful.
And then I realised - I have my own theme… arrrrgh…. and there is no tags to categories converter ;>
Well, here are steps how to update your own theme to support basic tags features:
1. Blog Entry
We are going to change from Filed under: Uncategorized to Tagged with: English • Photos • Travelling.
Open the wp-content/themes/YOUR_THEME/index.php file and change:
-
<?php _e("Filed under:"); ?> <?php the_category(‘,’) ?>
to
-
<?php the_tags(‘Tagged with: ‘,‘ • ‘,”); ?>
2. Sidebar
We are going to remove the obsolete categories list and replace it with a new shiny tag cloud:
Open the wp-content/themes/YOUR_THEME/sidebar.php file and change:
-
<li id="categories"><h4><?php _e(‘Categories:’); ?></h4>
-
<ul>
-
<?php wp_list_cats(); ?>
-
</ul>
-
</li>
to
-
<li id="categories"><h4><?php _e(‘Tags:’); ?></h4>
-
<ul>
-
<?php wp_tag_cloud(”); ?>
-
</ul>
-
</li>
Actually, I decided for smaller font sizes:
-
<?php wp_tag_cloud(‘largest=18′); ?>
Please, do not forget to click on [Show Plain Code] before copying source code.
For more details about the new commands see the version 2.3 announcement.
For more details about categories and tags see this apt blog entry: Tags Are Not Categories - Got It?.










