• <?php if (function_exists(‘z_taxonomy_image_url’)) echo z_taxonomy_image_url(); ?>

    This code used to display image
    But i want to display default image in case some category not have image…

    Question : How can i display default image in case of some category haven’t image.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Change your code to:
    <?php if (function_exists(‘z_taxonomy_image_url’)) echo z_taxonomy_image_url(NULL, NULL, TRUE); ?>

    The last value in the z_taxonomy_image_url() function is a flag to return the default image if none is set. The default image is located in: /wp-content/plugins/categories-images/images/placeholder.png

    @2gen Could you elaborate? I need help with getting the placeholder to show up also, and I don’t really understand your answer above.

    Here is my code:

    if (function_exists('z_taxonomy_image_url')) { 
    echo '<img src="' . z_taxonomy_image_url( $child, $taxonomy_name ) . '" />';
    }

    The above code shows the image that’s set. I need logic in place that says if the user hasn’t set an image, default to placeholder image.

    • This reply was modified 7 years, 9 months ago by vghardy.
    • This reply was modified 7 years, 9 months ago by vghardy.

    Try something like:

    if (function_exists('z_taxonomy_image_url')) { 
      echo '<img src="' . z_taxonomy_image_url( $child, $taxonomy_name, TRUE ) . '" />';
    }

    Note the added “TRUE” in the function call. This returns the image located at the following path if one isn’t set: /wp-content/plugins/categories-images/images/placeholder.png

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default Image of Category in case of not exist category Image’ is closed to new replies.