Related Tags Navigation added
Posted by sky | Tags: Php, WordPress, tagging
I am using plugin Simple Tagging. I made a slight modification to STP_RelatedTags and outputRelatedTags functions and uses STP_RelatedTags to show the related tags to the current tag being viewed. Basically, if a post is tagged with A and B, then tag A and B are related. I also use the below to generate the browse tags path. Eg. navigate_tags('php+Wordpress') will produce >> php >> Wordpress The tag navigation is equivalent to the one I used in Sky Explorer for application menu. :)
function get_tags($tag) {
return explode("+", $tag);
}
function navigate_tags($tag) {
$tags = get_tags($tag);
$tagUri = '/tag/';
$link = '';
$tagfmt = '>> <a href="%link%">%name%</a> ';
$tagvars = array("%link%", "%name%");
$nav = '';
foreach ($tags as $t) {
$link .= (($link != '')? '+' : '') . $t;
$nav .= str_replace($tagvars, array($tagUri.$link, $t), $tagfmt);
}
return $nav;
}
Previous Post
Next Post