'WordPress - include category slug as class in all category links on posts page
Stumped on this one - shouldn't this be a gimme?
I have a new design for a blog posts page that calls for all category links in the sidebar to have unique colors. Then for post excerpts on page, the category link should correlate to the sidebar link color.
e.g., Sidebar category "Best Practices" link is blue. Post excerpts on page that are that category should have the category name "Best Practices" blue as well.
I can randomly assign colors to these sidebar links using css but again I can't make a correlation to post excerpt links. Just like a single post page, I would like to inject a category slug class in all links.
So for sidebar category links
<li class="cat-item cat-item-4401"><a href="">Best Practices</a></li>
should be
<li class="cat-item cat-item-4401 category-best-practices"><a href="">Best Practices</a></li>
and a post excerpt category link which is
<span class="blog-categories minor-meta"><a href="" rel="tag">Best Practices</a> </span>
should be
<span class="blog-categories minor-meta category-best-practices"><a href="" rel="tag">Best Practices</a> </span>
Appreciate any feedback on this one!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
