Show Taxonomy Child Terms (name and image) on Parent Term Page
-
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 3aOn 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 name of the child associated to parent. But I also like to add image of child along with the name. It would be great if you could help me out with this. Thanks.
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.