The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Post Thumbnail Based on Category

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #28739

    I’m making a ton of icons to be used in the custom field area. Balloons for birthdays/anniversaries. trophy for awards, etc etc. The icons correspond with the category the post belongs in. is there a way to automatically spit them out in the loop next to the post title based on the posts category?

    anybody done this before?


    I have no idea if this is possible. This is just a theory, and the code is probably wrong:

    <?php echo get_post_meta($post->ID, the_category(), true); ?>

    So, you would name all of the custom fields by the category that they relate to.


    i should have added that i want to spit them out without having to enter anything in the custom field but using the custom fields was my first approach. this is for an internal blog used at my work. Any employee can use it so i was hoping to have it all automated. they just need to pick the category and if there’s a corresponding image it shows up. if not the title is just left aligned.

    think what you’re saying would work in this condition?

    trying to avoid teaching anybody how to use custom fields if i can.
    having it show up if ones available would be idea. i found this but i havent looked over it completely yet. … il-images/

    not sure if thats exactly what im looking for or not.


    Ah, right, that makes more sense, let’s ignore custom fields altogether!

    This could be tedious depending on how many categories you have, but you could simply hard code it into the template and run some wonderful queries on the loop based on the category.


    like a lot of if else logic stuff?

    i have no problem with going the hard coding route if needed. think thats the best option?


    It makes the most sense to me, to be honest.

    Plus, pretty quick to add another category in there should you need to expand it.


    true. alright i’ll give that a go. thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.