Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need a simple way of assigning a custom icon whenever a category gets listed.

I am using Custom Post Types and Taxonomies with Views and Types (plugins).

For example, I have a Custom Post Type of Properties > and categories of Commercial/Residential/Hotels (each need an icon).

Maybe assigning a class some how to each would be a good way...

I think this would be a very useful thing for a lot of people so would really appreciate any thoughts/suggestions!

share|improve this question
    
Where are those lists? Front-end, back-end? Please be specific. –  toscho Nov 16 '12 at 5:47
add comment

1 Answer

If your theme uses body_class and post_class then you should have CSS enough to do this.

Make a <div> for your icon.

<div class="mycategoryicon"></div>

Add some style.

.category-slug .mycategoryicon {
    height:32px;
    width:32px;
    background:#ffffff url('slug-icon.jpg') no-repeat;
}

The "slug" part of the class name should be your actual category slug. Height and width can of course be whatever you need.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.