adding of conditions on the template file
-
hello to all,
how can i add condition on this code:<div class="single-specials">Special 1</div> <div class="info"> <ul> <li class="sm-name-info"><strong>Name: </strong> <?php echo do_shortcode('[ecpt_field id="name"]'); ?></li> <li class="sm-image-info"><img src="<?php echo get_post_meta($post->ID, 'ecpt_image', true); ?>" alt=""/><!--<img src="/wp-content/themes/twentyeleven/images/dummy-img.jpg" />--></li> <li class="sm-desc-info"><strong>Description: </strong><?php echo do_shortcode('[ecpt_field id="description"]'); ?></li> <div class="clear"></div> </ul> </div>
i would like to add condition that will hide the whole div/ class=”single-special” if all fields name, description and image is empty. However if one of the fields has a value say for example name, only name will display and so on. so it will look something like this:
Specials 1
Name: Sample name;i know i should use php code, if else but i’m not good at it. so if anybody knows how, please help me. thanks.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘adding of conditions on the template file’ is closed to new replies.