Title: adding link get_the_category
Last modified: August 19, 2016

---

# adding link get_the_category

 *  Resolved [Otenyano](https://wordpress.org/support/users/junrill/)
 * (@junrill)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/adding-link-get_the_category/)
 * <?php
    foreach((get_the_category()) as $category) { echo ‘<img src=”[http://example.com/images/&#8217](http://example.com/images/&#8217);.
   $category->cat_ID . ‘.jpg” alt=”‘ . $category->cat_name . ‘” />’; } ?>
 * Anyone got an idea on how to link this on there category?
 * thanks

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/adding-link-get_the_category/#post-1246468)
 * Not sure what you are asking so will throw this out there:
 *     ```
       echo '<p> category ' . '<a href="' . get_category_link( $category->cat_ID, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->cat_name.'</a> has ' . $category->count . ' post(s). </p> ';
       ```
   
 *  Thread Starter [Otenyano](https://wordpress.org/support/users/junrill/)
 * (@junrill)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/adding-link-get_the_category/#post-1246478)
 * get_category_link();
 * sheyt… thanks man.

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

The topic ‘adding link get_the_category’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Otenyano](https://wordpress.org/support/users/junrill/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/adding-link-get_the_category/#post-1246478)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
