Software Guide

Die besten Tipps, Anleitungen und Downloads

Ihre Werbung auf Software Guide

Sie möchten in dieser Box oder an anderer Stelle dieser Webseiten eine Werbung schalten? Sehen Sie sich dazu am besten einfach mal die verschiedenen Möglichkeiten an.


Category Tagging

I do no longer develop this plugin. A new developer has picked it up, and you can find all the latest here: Category Tagging

PluginWordPress has a categorization system that lets users categorize posts. However, using categories is no longer state of the art: In the word wide web, tagging is established — and categorizing is obsolete. Tagging is quite different to categorizing since it is based on keywords, for details see Wikipedia’s articles Tags and Folksonomy.

For using tags in WordPress, one of the following plugins is recommended:

Both plugins offer the possibility to use tags in WordPress and provide additional features such as a tag cloud. In addition, they still allow the usage of the WordPress categories.

However, if you do not need categories at all, why don’t you use the WordPress categories as tags?

Category Tagging

First of all, let’s summarize what is needed if we want to use tags on a blog:

  • Assigning one ore more tags to each post
  • Displaying a sorted list of all tags that are used in the blog
  • Tag cloud
  • Displaying the tags in each post as part of the post’s meta data

In addition, we could use the tags of each post to display a list of related posts. Such list would be more accurate than a PHP code that retrieves related posts programmatically from the database.

Solution

Several things you need for tagging are already covered by WordPress functions:

  1. Assigning one ore more tags to each post
    Just use the WordPress categories and assign tags (categories) to each post:
    WordPress Categories
  2. Sorted list of tags
    Use wp_list_cats wherever you want to display a list of all used tags in your blog.
    In the following you find an example that displays all tags, sorted by name and displaying the number of posts that have these tags:

    <?php wp_list_cats('sort_column=name&optioncount=1'); ?>
  3. Displaying the tags as part of the post’s meta data
    This is already in use in almost every template. See the_category for details. Example:

    <?php echo 'Tags: '; the_category(', '); ?>

    If you want to have these tags displayed as list or format the output individually, you can use the following code:

    <?php
    	echo "\n<ul>\n"; 
    	foreach((get_the_category()) as $cat) {
    		echo '<li><a rel="tag" title="' . $cat->cat_name .'" href="' . get_category_link($cat->cat_ID) . '">' . $cat->cat_name . '</a></li>' . "\n";
    	}
    	echo "</ul>\n";
    ?>

In addition to the WordPress functions, the Category Tagging Plugin provides the following features:

  1. Tag cloud
    It displays all tags (categories) as tag cloud:
    Tagcloud
  2. Related posts
    When visitors find your website via search engines or other websites, they are often there for a reason and want to find out about a particular topic of interest. Presenting a list of related posts to a given post makes life easier for your visitors by showing them other posts you have written on the subject. This increases the chance that a visitor will stick around browsing your blog, and is perfect for existing visitors to find out your past thoughts on a particular subject.
    The function cattag_related_posts() presents related posts according to the tags (categories) of the current post.

Category Tagging Plugin

You also can download the obsolete version which will only work with WordPress 2.0.x: Download Obsolete Version 1.3.

Note that the parameters have been changed since plugin version 2.0, so if you upgrade from plugin version 1.3 or lower, double-check the parameters you are passing.

Installation

The Category Tagging Plugin can be installed in 3 easy steps:

  • Download the plugin (see „Downloads“ above).
  • Decompress the .zip archive and put the file category-tagging.php into your plugins directory (/wp-content/plugins/) or into a sub directory of the plugins directory.
  • Enable the plugin in the WordPress Plugins admin page.

Usage

1. Tag Cloud

  • Open the appropriate file of your theme to add the tagcloud, e.g. archives.php.
  • Add the following code to the section where you want to display the tag cloud:
    <?php
    if (function_exists ('cattag_tagcloud') ) {
    	echo '<ul class="tagcloud">' . cattag_tagcloud() . '</ul>';
    }
    ?>
  • Syntax of the cattag_tagcloud() function:
    $min_scale = 10,
    $max_scale = 30,
    $min_include = 0,
    $sort_by = 'NAME_ASC',
    $exclude = '',
    $include = '',
    $format = '<li><a rel="tag" href="%link%" title="%description% (%count%)" style="font-size:%size%pt">%title%<sub style="font-size:60%; color:#ccc;">%count%</sub></a></li>',
    $notfound = 'No tags found.'
  • Parameters:
      These parameters are for plugin version 2.0 and above, if you use plugin version 1.3 or lower, please check the plugin’s source code to see which parameters are available and in what order you need to pass them.
    • $min_scale: Used for scaling the tags. This is the minimum value scaled to. The default is 10.
    • $max_scale: Used for scaling the tags. This is the maximum value scaled to. The default is 30.
    • $min_include: Minimum tag count required: Tags must be used at least this many times to show up in the cloud. The default is 0 (all tags will be included).
    • $sort_by:
      • NAME_ASC: Sorted by tag name, ascending.
      • NAME_DESC: Sorted by tag name, descending.
      • WEIGHT_ASC: Sorted by number of posts that have the tags assigned, ascending.
      • WEIGHT_DESC: Sorted by number of posts that have the tags assigned, descending.
      • RANDOM: Randomized every time the page is loaded.
    • $exclude: This string sets the tags to be excluded (category ID). The default is '' (empty string). It must be in the form of an array (ex: '1, 2, 3').
    • $include: This string sets the tags to be included (category ID). Only these tags will be displayed if something is entered. The default is '' (empty string). It must be in the form of an array (ex: '1, 2, 3').
    • $format: The text/html output for each tag. You can use any text you like and the function will automatically replace the following identifiers:
      • %link% is replaced by the tag URL.
      • %title% is replaced by the actual tag name.
      • %description% is replaced by the description provided by WordPress. If you use Category Descriptions, then these will be used.
      • %count% is replaced by the number of times the tag is used.
      • %size% is replaced by the calculated font size for each tag.
    • $notfound: String that is returned if no tags were found.
  • For details on how to pass parameters, see WordPress.org: How to Pass Parameters. Example (set $min_include to 2 and sort cloud by weight):
    <?php
    if (function_exists ('cattag_tagcloud') ) {
    	echo '<ul class="tagcloud">' . cattag_tagcloud(10, 30, 2, 'WEIGHT_DESC') . '</ul>';
    }
    ?>

2. Related Posts

  • Open the appropriate file of your theme to add the related posts, in most cases it is the file index.php or single.php in your theme folder.
  • Add the following code to the section where you want the related posts to be displayed:
    <?php
    if( function_exists('cattag_related_posts') ) {
    	echo '<ul>' . cattag_related_posts() . '</ul>';
    }
    ?>
  • Syntax of the cattag_related_posts function:
    $order = 'RANDOM',
    $limit = 5,
    $exclude = '',
    $display_posts = true,
    $display_pages = false,	
    $format = '<li>%date%: <a href="%permalink%" title="%title%">%title%</a> (%commentcount%)</li>',
    $dateformat = 'd.m.y',
    $notfound = '<li>No related posts found.</li>',
    $limit_days = 365
  • Parameters:
      These parameters are for plugin version 2.0 and above, if you use plugin version 1.3 or lower, please check the plugin’s source code to see which parameters are available and in what order you need to pass them.
    • $order: DATE_DESC sorts the related posts by post date, descending; RANDOM displays the related posts in a random order. The default is RANDOM.
    • $limit: Number of related posts to be displayed. The default is 5.
    • $exclude: Tags to be excluded according to category ID. The default is '' (empty string). It must be in the form of an array (ex: '1, 2, 3').
    • $display_posts: Consider tags assigned to posts? The default is TRUE.
    • $display_pages: Consider tags assigned to pages? The default is FALSE.
    • $format: The text/html output for each related post. You can use any text you like and the function will automatically replace the following identifiers:
      • %date% is replaced by the posting date. Please see also $dateformat for formatting the date.
      • %permalink% is replaced by the URL of the post.
      • %title% is replaced by the title of the related post.
      • %commentcount% is replaced by the number of comments.
    • $dateformat: format of the post’s date (%date%) used in $format, see PHP: date – Manual for details.
    • $notfound: String that is returned if no related post was found.
    • $limit_days: Max. number of days to be considered, 365 means that related posts of the past 365 days are being considered.

    For details on how to pass parameters, see WordPress.org: How to Pass Parameters.

Frequently Asked Questions

  1. Question: In WordPress 2.0.2, I have 120 categories. But when I go to write a Post, not all of the categories are listed in the „Categories“ section, 20 of them are missing.

    Answer: That’s a WordPress related issue: In the file /wp-admin/admin-functions.php, the categories are limited to 100. See the WordPress forum thread Missing categories in the Write Post page, aprilprincesse explains how to solve this issue.

Miscellaneous

  • SteamSHIFT has developed a widget that grabs the tag cloud from the Category Tagging plugin and displays it.
    However, since this widget will not work with WordPress 2.1, Alex has developed a leaner version of steamshift’s category cloud widget which will work with WordPress 2.1 but requires Category Tagging plugin to be installed as well.
  • Check out Doug’s detailed installation instructions for this plugin

Version History and Changelog

  • 2.3 [2007-02-02]:
    New Feature: Now supporting random sorting of the category cloud. Thanks, Alex.
  • 2.2 [2006-01-30]:
    Bug Fix: Exclusion of categories in related posts didn’t work.
  • 2.1 [2006-01-24]:
    Bug Fix: Sorting corrected.
  • 2.0 [2006-01-19]:
    Plugin is now compatible with WordPress 2.1 — and no longer compatible with 2.0.x.
  • 1.3 [2006-12-20]:
    Bug fix: Related posts that are scheduled for the future are no longer being displayed in the related posts list.
  • 1.2 [2006-07-21]:
    New feature: Parameter for excluding categories from related posts
  • 1.1 [2006-05-10]:
    New feature: Parameters for sorting tagcloud
    New feature: Support of category descriptions
  • 1.0 [2006-04-02]:
    Initial release.

Donation

You like this plugin? Any donation would be highly appreciated:

Blog-Kategorien

Volltextsuche

Neueste Artikel

Neueste Kommentare

Neueste Trackbacks/Pingbacks

Andere Projekte

Blogparade

dient als zentrale Anlaufstelle für Blog-Paraden bzw. Blog-Karnevals und andere von BloggerInnen veranstaltete Aktionen.

Mediadaten

Feed-Statistik:
Feedburner

Software Guide gibt es seit Dezember 2005 und es werden durchschnittlich 2 Blog- Beiträge/Monat veröffentlicht. Die Themenschwerpunkte sind in der Tagcloud ersichtlich. Mehr Infos...

Links

 

Nach oben

Wordpress

© 2005-2024 Software Guide | ISSN 1864-9599