A recent WordPress project required having a recent posts widget that each link was styled differently with CSS based on what category the post came from. A bit of a jargon loaded sentence I admit.
Basically, if a “recent post” link in this widget was from the “Tools” category (for instance) then it could be styled with a CSS background image or a color specific to that category.
I ended up modifying this Recent Posts plugin. (In enhanced-recent-posts/includes/plugin-class.php line 116)
Here is what I ended up using:
This WordPress function for getting the category was very helpful.
Have a better way to style links with CSS by category? Bonus if there is a plugin already doing this.
I’m viewing this page in Chrome, and I can’t see the code samples. I tried it in FF and still couldn’t see them.
Dude sort out your page, the code that you present is hidden in a way or another. For the visitors here, if you want to view the codes he is trying to show, then use Firebug for Firefox and inspect the element on those areas. :)
Blake Imeson says
Sorry guys, hopefully the code is fixed now.