Adding category-id or tag-name to css tags?
-
Hi all,
I am modifying / writing a theme and have hit a brick wall.
I want to be able to specify colours for category and tag links depending on what they are.
I have used the following code in “the loop” to produce a list of categories
<?php echo get_the_category_list(); ?>
this outputs the following:
<ul class="post-categories"> <li><a href="http://mysite.com/category/outdoor-garden/" rel="category tag">Outdoor</a></li></ul>
What I want to output is
<ul class="post-categories"> <li class="category-name category-ID"><a href="http://mysite.com/category/outdoor-garden/" rel="category tag">Outdoor</a></li></ul>
I would like to be able to achieve the same for tags if possible,
This is the code I am currently using:
<?php if(get_the_tag_list()) { echo get_the_tag_list('<ul><li>','</li><li>','</li></ul>'); } ?>
Which Outputs:
<ul> <li><a href="tag1">Tag 1</a></li> <li><a href="tag2">Tag 2</a></li> ... </ul>
What I want to achieve is:
<ul> <li class="tag-1"><a href="tag1">Tag 1</a></li> <li class="tag-2"><a href="tag2">Tag 2</a></li> ... </ul>
Is this possible? I have searched and searched and seem to be going around in circles.
Many Thanks
James
- The topic ‘Adding category-id or tag-name to css tags?’ is closed to new replies.