Version: 2.0.4 Turn a list of tag IDs and/or slugs into a list of links to those tags.
The plugin provides one template tag for use in your theme templates, functions.php, or plugins.
<?php c2c_linkify_tags( $tags, $before = '', $after = '', $between = ', ', $before_last = '', $none = '' ) ?>
Displays links to each of any number of tags specified via tag IDs/slugs$tags
A single tag ID/slug, or multiple tag IDs/slugs defined via an array, or multiple tags IDs/slugs defined via a comma-separated and/or space-separated string
$before
(optional) To appear before the entire tag listing (if tags exist or if 'none' setting is specified)
$after
(optional) To appear after the entire tag listing (if tags exist or if 'none' setting is specified)
$between
(optional) To appear between tags
$before_last
(optional) To appear between the second-to-last and last element, if not specified, 'between' value is used
$none
(optional) To appear when no tags have been found. If blank, then the entire function doesn't display anything
<?php c2c_linkify_tags(43); ?>
<?php c2c_linkify_tags("43"); ?>
<?php c2c_linkify_tags("books"); ?>
<?php c2c_linkify_tags("43 92 102"); ?>
<?php c2c_linkify_tags("book movies programming-notes"); ?>
<?php c2c_linkify_tags("book 92 programming-notes"); ?>
<?php c2c_linkify_tags("43,92,102"); ?>
<?php c2c_linkify_tags("book,movies,programming-notes"); ?>
<?php c2c_linkify_tags("book,92,programming-notes"); ?>
<?php c2c_linkify_tags("43, 92, 102"); ?>
<?php c2c_linkify_tags("book, movies, programming-notes"); ?>
<?php c2c_linkify_tags("book, 92, programming-notes"); ?>
<?php c2c_linkify_tags(array(43,92,102)); ?>
<?php c2c_linkify_tags(array("43","92","102")); ?>
<?php c2c_linkify_tags(array("book","movies","programming-notes")); ?>
<?php c2c_linkify_tags(array("book",92,"programming-notes")); ?>
<?php c2c_linkify_tags("43 92"); ?>Outputs something like:
<a href="http://yourblog.com/archives/tags/books">Books</a>, <a href="http://yourblog.com/archives/tags/movies">Movies</a>
<?php c2c_linkify_tags("43, 92", "<li>", "</li>", "</li><li>"); ?></ul>Outputs something like:
<ul><li><a href="http://yourblog.com/archives/tags/books">Books</a></li><li><a href="http://yourblog.com/archives/tags/movies">Movies</a></li></ul>
<?php c2c_linkify_tags(""); // Assume you passed an empty string as the first value ?>Displays nothing.
<?php c2c_linkify_tags("", "", "", "", "", "No related tags."); // Assume you passed an empty string as the first value ?>Outputs:
No related tags.
The plugin exposes one action for hooking.
The 'c2c_linkify_tags' hook allows you to use an alternative approach to safely invoke c2c_linkify_tags() in such a way that if the plugin were to be deactivated or deleted, then your calls to the function won't cause errors in your site.
Arguments:
c2c_linkify_tags()Example:
Instead of:
<?php c2c_linkify_tags( "43, 92", 'Tags: ' ); ?>
Do:
<?php do_action( 'c2c_linkify_tags', "43, 92", 'Tags: ' ); ?>
Requires: 2.8 or higher
Compatible up to: 3.5.1
Last Updated: 2012-12-10
Downloads: 2,170
Got something to say? Need help?