Category Icons, Release 1.0

After a few changes in my original plan, the category icons are now working. I decided that it was too cluttered to have an icon on every single post, so there are now three categories:

  • Office 12 posts, with the icon you see on this post (above).
  • Doug’s Photos posts, with the icon you can see on things like the Christmas Day post below.
  • All other posts, which don’t have an icon.

In the past, I always put thumbnails of photos on the posts that included photos, so that you could tell at a glance there was a picture available. Going forward, I think I’ll do that less often to keep the RSS feeds quick and simple.

For those who are curious about such things, here’s the code I added to my post.php file to get the category icons to appear:


< ?php if ( in_category('5') ) { ?>
     <img src=”http://www.mahugh.com/images/icon_o12.jpg”  border=0 alt=”Office 12 post” align=right style=”margin: 0″/>
< ?php } else { ?>
  < ?php if ( in_category('6') ) { ?>
       <img src=”http://www.mahugh.com/images/icon_doug.gif” border=0 alt=”Doug’s photos post” align=right style=”margin: 0″/>
  < ?php } else { ?>
  < ?php } ?>
< ?php } ?>



Note that this code is in post.php so that it runs every time a post is displayed. At first I put it in index.php, but that only makes the icons appear in the blog home page, and not in things like the Christmas Day link above. The legend in the sidebar on the right, however, is in index.php so that it will only appear on the home page.

This entry was posted on Thursday, December 29th, 2005 at 3:36 pm. You can subscribe to comments on this post through its RSS feed.

No comments have been posted

Be the first to comment on this entry.

Have your say

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.