Title: category image problem
Last modified: August 19, 2016

---

# category image problem

 *  Resolved [gbaka](https://wordpress.org/support/users/gbaka/)
 * (@gbaka)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/category-image-problem/)
 * I’m trying to add this code to my category for images
 *     ```
       <?php
       foreach((get_the_category()) as $category) {
           echo '<img src="http://test.ani-down.net/images/wpaper/'. $category->cat_name .'.jpg" alt="'. $category->cat_ID .'" />';
       }
       ?>
       ```
   
 * but the code doesn’t change IDs on different category pages I’m stuck with 1 
   image on all categories.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/category-image-problem/#post-1034503)
 * Try:
 *     ```
       <?php
       $this_category = get_category($cat);
       echo '<img src="http://test.ani-down.net/images/wpaper/'. $this_category->cat_name .'.jpg" alt="'. $this_category->cat_ID .'" />';
       ?>
       ```
   
 *  Thread Starter [gbaka](https://wordpress.org/support/users/gbaka/)
 * (@gbaka)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/category-image-problem/#post-1034511)
 * thank you so much it fixed the problem.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘category image problem’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [id](https://wordpress.org/support/topic-tag/id/)
 * [images](https://wordpress.org/support/topic-tag/images/)

 * 2 replies
 * 2 participants
 * Last reply from: [gbaka](https://wordpress.org/support/users/gbaka/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/category-image-problem/#post-1034511)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
