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.