Here’s the code that I got.
<?php
function category_image () {
if (function_exists('z_taxonomy_image_url')) {
foreach (get_the_category() as $cat) :
?>
<a href="<?php echo get_category_link($cat->term_id); ?>" alt="<?php echo $cat->cat_name; ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
<?
endforeach;
}
}
?>
So I want to make it that IF z_taxonomy_image_url is blank, do not run the code. Right now it’s displaying the image whether there’s an image or not because the function at all times.
Thanks for the help!
Just add an
if(!z_taxonomy_image_url($cat->term_id)) continue;in your code before echo. Something like this: