Support » Themes and Templates » Changing icon based on post type

  • Hey all, I was wondering if there was a way to change an icon next to my subject line based on the type of post I’m making. eg, a post about a trip I took will have an icon of the world, a post about pictures will have an icon with a photograph, etc.

    If you need an example here is my site:

    Please note that currently only the “bio” and “contact” links work… I’ve set them up to give an idea of how I want it to work, but I was wondering if there was a way to do it without having to add code when I’m making a post… perhaps a drop down menu of the pre-made icons I want or something.

    I just upgraded my version today and noticed an area where I can add a custom field… perhaps this would be the easiest way?

    Any help or suggestions would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Eric Amundson


    Volunteer Moderator

    Yes. There are probably a few ways to do this. I haven’t done it yet, but will be implementing something similar on another site soon.

    Dan Cederholm does a similar thing on

    You may check out:

    I’d start by adding a class to the <div class=”post_header”> based on the category or category ID.

    So for a category named ‘travels’ you’d setup the template with a snippet of code that output the category name(s) or ID.

    So the output might look like:

    <div class=”post_header travels”>My trip to Spain</div>

    Then, in your CSS, you’d set a different background image for each class of category-specific div.

    This would probably work best if you only assign one cat per post.

    If you have multiple categories per post, you could try to use the Custom Fields and implement a little PHP that looks for the presence of a custom field named, say ‘icon’ and if it’s there, reads the value of that field and outputs it in your markup.


    here is a plugin for that :

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Changing icon based on post type’ is closed to new replies.