Title: Parent Image
Last modified: July 10, 2018

---

# Parent Image

 *  [ageingdj](https://wordpress.org/support/users/ageingdj/)
 * (@ageingdj)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/parent-image/)
 * Hi there,
    The code below returns a list of [posts] Parent category titles which
   works. What I can’t figure out is how to add the thumbnail (but I’ll take any
   size) image for each one. It’s probaly simple but I can’t figure it out. Many
   thanks
 *     ```
       <?php
       /* template name: ParentCatTemplate */
       get_header(); ?>
           <?php
       // get_categories() function will return all the categories
            $upaae_categories = get_categories( array(  'orderby' => 'name',  'order' => 'ASC' ) ); 
                 foreach( $upaae_categories as $single_cat ) {  if($single_cat->parent < 1) 
                 // Display if parent category and exclude child categories  
                     {$category_link = sprintf( '<a href="%1$s" alt="%2$s">%3$s</a>', esc_url( get_category_link( $single_cat->term_id ) ),  
                     esc_attr( sprintf( 'View all posts in %s', 'textdomain' ), $single_cat->name ),  esc_html( $single_cat->name ));  
                   echo 
                    sprintf( $category_link ).'</br>';  } } 
           ?>
       <?php get_footer(); ?>
       ```
   

The topic ‘Parent Image’ is closed to new replies.

 * ![](https://ps.w.org/taxonomy-images/assets/icon-256x256.png?rev=1283547)
 * [Taxonomy Images](https://wordpress.org/plugins/taxonomy-images/)
 * [Support Threads](https://wordpress.org/support/plugin/taxonomy-images/)
 * [Active Topics](https://wordpress.org/support/plugin/taxonomy-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/taxonomy-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/taxonomy-images/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [ageingdj](https://wordpress.org/support/users/ageingdj/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/parent-image/)
 * Status: not resolved