It is populating parent image instead of the one I chose
-
Hello Muhammad,
I think I am doing something wrong, When I get an image by using subcategories show the parent category’s image.
And the parent category isn’t showing its own image.
I read that gloriagoldrea had the same problem, but I did not understand how it was solved
my loop
//for this category on an archive page, get the ID
$thisID = get_query_var(‘cat’);$get_children_cats = array(
‘parent’ => $thisID //get children of this parent using the thisID variable from earlier
);$child_cats = get_categories( $get_children_cats );//get children of this parent category
foreach( $child_cats as $child_cat ){
//for each child category, get the ID
$childID = $child_cat->cat_ID;//for each child category, give us the link and name and description
echo ‘<aside id=”” class=”widget widget_text”><h3 class=”widget-title”>‘ . $child_cat->name . ‘‘;
echo ‘<span>’ . $child_cat->category_description . ‘</span></h3>’;
echo ‘<div class=”textwidget”><img src=”‘;
if (function_exists(‘z_taxonomy_image_url’)) echo z_taxonomy_image_url();
echo ‘” width=”450″ height=”450″></div></aside>’;} //end of categories logic ?>
Many thanks,
Paolo
- The topic ‘It is populating parent image instead of the one I chose’ is closed to new replies.