Support » Fixing WordPress » how to display subcategory images in main category

  • Hello every one
    i am using this code to display the only subcategories in the main category page

    if (is_category()) {
      $this_category = get_category($cat);
      if (get_category_children($this_category->cat_ID) != "") {
        echo "";
        echo "<ul>";
        echo "</ul>";

    this codes works perfectly but i want to add image for the subcategories links (like post thumbnail) that image link to the subcategory?
    1) how i can add image for categories?
    2) how i can display thats images to the subcategories list?
    is this possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • heard of a plugin th do this but not sure..
    workaround is to save images separately on server and then display via loop. instead of wp_list_categories, use get_categories with param ‘child_of=’.$this_category->cat_ID’. and then in a foreach loop, display each, which also gives you an option to output image..
    if its 1 image for all then give it as list-style in ul.

    shadez thank for your reply
    i have another idea for that
    can id display the first featured post thumbnail of subcategory with its name ?
    if this possible web have a grid of thumbs of subcategory in main category page that i like it
    is this possible?

    oh yeah thats cool too… maybe this string will work:


    check it out and let know.. 🙂

    how i can use this ?
    please explain me width an example of usage

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to display subcategory images in main category’ is closed to new replies.