Wordpress: Adding class selectors to the_tags(); output
Also you can overload working of get_the_tags();
function. Just add next code to your functions.php
theme file:
// add custom class to tagfunction add_class_the_tags($html){ $postid = get_the_ID(); $html = str_replace('<a','<a class="class-name"',$html); return $html;}add_filter('the_tags','add_class_the_tags');
this code from www.lawturn.com
/* SlSlib tags add class */<?php if(has_tag()) : ?> <?php $tags = get_the_tags(get_the_ID()); foreach($tags as $tag){ echo '<a href="'.get_tag_link($tag->term_id).'" rel="tag" class="tag-'.$tag->name.'">'.$tag->name.'</a>'; } ?><?php endif; ?>