Title: embedded if statement inside if statement
Last modified: August 22, 2016

---

# embedded if statement inside if statement

 *  [helpmeplease90](https://wordpress.org/support/users/helpmeplease90/)
 * (@helpmeplease90)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/embedded-if-statement-inside-if-statement/)
 * Im trying to display a set of category header images using the Custom Tax Image
   plugin.
 * But I want to only display the image if the image is available, and if it is 
   available I want to display different set of <h1> text depending on what category
   you are viewing.
 * So it would be a If statement inside a If statement.
 * This is what I currently have. But it is not working.
 *     ```
       <?php if (function_exists('z_taxonomy_image_url')) {
       								if (cat_is_ancestor_of(392, $cat)) {
       									echo '<div id="cat-header"><img id="cat-banner" src="' . z_taxonomy_image_url() . '"><p>Restaurants Serving</p><h1>' . single_cat_title(); . '</h1>' . ft_custom_breadcrumbs(); . '</div>';
       								} elseif (is_category('392')) {
       									echo '<div id="cat-header"><img id="cat-banner" src="' . z_taxonomy_image_url() . '"><p>Restaurants By</p><h1>' . single_cat_title(); . '</h1>' . ft_custom_breadcrumbs(); . '</div>';
       								} else {
       									echo '<div id="cat-header"><img id="cat-banner" src="' . z_taxonomy_image_url() . '"><p>Restaurants In</p><h1>' . single_cat_title(); . '</h1>' . ft_custom_breadcrumbs(); . '</div>';
       								}
       						} else {
       							echo '<div id="cat-header"><p>Restaurants Serving</p><h1>' . single_cat_title(); . '</h1>' . ft_custom_breadcrumbs(); . '</div>';
       						}?>
       ```
   

The topic ‘embedded if statement inside if statement’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [helpmeplease90](https://wordpress.org/support/users/helpmeplease90/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/embedded-if-statement-inside-if-statement/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
