Support » Plugin: Taxonomy Images » 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.