• Skip to main content
  • Skip to footer

Blake Imeson

Web Entrepreneur | WordPress Geek

  • Home
  • About Blake
  • Connect with Me
  • Contact

Blake Imeson / June 16, 2011

Style Links with CSS by Category – WordPress

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:
[php num=”116″][/html]

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.

LinkedinShareTweetSubscribe to BlogEmail
Subscribe to Blog via Email
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Email Address Subscribe Now

Filed Under: Tech Tagged With: category, CSS, recent posts, WordPress

Related

Reader Interactions

Comments

  1. Rick says

    June 29, 2012 at 11:09 am

    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.

    Reply
  2. Amanda says

    August 19, 2012 at 12:58 pm

    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. :)

    Reply
  3. Blake Imeson says

    August 22, 2012 at 12:00 pm

    Sorry guys, hopefully the code is fixed now.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Footer

Blog Categories

Blog Archives

Blog Topics

.com 2.7 2008 addons AlphaLab Amazon applications apps April Fools autodidactic backup bailouts Blogging blogs bootstrapping CMS college CSS Del.icio.us efficiency email Entrepreneurship Facebook Firefox Gmail Google Google Apps Grove City College internet entrepreneurship LinkedIn links PCPGH3 plugins reputation management RSS SEO Seth Godin shared Social Bookmarking Social Media technology themes website Wikipedia WordPress

Copyleft © 2008–2023 Blake Imeson · Powered by WordPress of course

  • Home
  • LimeCuda.com
  • LimeCuda Portfolio
  • FewerThanThree.com
  • Sitemap

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.