Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

cipriano200 on "how to convert this code?"

$
0
0

The code below pulls child categories of a parent, works perfectly.

Still i want to use this type of solution for TAXONOMIES, any ideas how to convert this?

<?php
global $ancestor;
$childcats = get_categories('child_of=' . $cat . '&hide_empty=1');
foreach ($childcats as $childcat) {
  if (cat_is_ancestor_of($ancestor, $childcat->cat_ID) == false){
    echo '<a class="trick product-search-item" href="'.get_category_link($childcat->cat_ID).'">';

	echo '<img src=';
	echo z_taxonomy_image_url($childcat->term_id);
	echo '>';
	echo '<div class="icon"></div>';
	echo '<span>';
	echo $childcat->cat_name . '</span>';
    echo '</a>';
    $ancestor = $childcat->cat_ID;
  }
}
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles