• I am trying to show respective child taxonomy term names and images on their parent term pages.

    For example:

    Parent Term A
    Child Term 1a
    Child Term 2a
    Child Term 3a

    On the Parent Term A taxonomy page, I want to show the taxonomy name and image for the 3 child terms 1a, 2a, and 3a and have each linked to their respective taxonomy term page. Child term 1a (name and image), for example would link to the Child term 1a taxonomy page.

    Right now I can show the child name and link to the parent page. but wants to show the child name with the image. it would be great if you could help me with that. following is my code to display child on parent page:

    
    $term_id = get_queried_object_id();
    $taxonomy_name = 'post_tag';
    $term_children = get_term_children( $term_id, $taxonomy_name );
    
    foreach ( $term_children as $child ) {
               $term = get_term_by( 'id', $child, $taxonomy_name );
               $string .= '<li><a href="' . get_term_link( $child, $taxonomy_name ) . '">' . $term->name . '</a></li>';
       }
       return $string;
    

    this code displays the child name in parent page but how to add the image of the child? Thanks.

    • This topic was modified 6 years, 9 months ago by mywp2018.
    • This topic was modified 6 years, 9 months ago by mywp2018.
    • This topic was modified 6 years, 9 months ago by mywp2018.

    The page I need help with: [log in to see the link]

  • The topic ‘Show Taxonomy Child Terms (name and image) on Parent Term Page’ is closed to new replies.