Support » Plugins » Category Icon Images Suggestions?

  • I’m looking for a way to have an image in place of the first category of a multi-category post where the rest of the categories are displayed by text name. The image needs to link to that one category’s archive. Any ideas?

Viewing 1 replies (of 1 total)
  • I think this would present problems due to category weighting. Because the categories for the post are shown in ID order, so you may not have an image representing the category you want.

    Be that as it may, on solution (probably the worst compared to an external hack or a plugin) requires hacking the code of template-functions-category.php in wp-includes (at least on the 1.2.x versions).

    Starting around line 60 where the function the_category is set, set a counter variable outside the foreach loop, then do an if...then checking that it’s the first category, and replicate the same code but change the link-text to an image tag using whatever code you want to generate it.

    There’s probably a much tidier way of doing this but…

Viewing 1 replies (of 1 total)
  • The topic ‘Category Icon Images Suggestions?’ is closed to new replies.