首先,如果我的问题表述不正确,我很抱歉,我是wordpress和php新手。我希望我不是太傻。
我有这个:
<div class="propsmeta clearfix">
<div class="propslist"><span>Locatie- </span> <span class="propval"> <?php echo get_the_term_list( $post->ID, \'location\', \'\', \' \', \'\' ); ?></span></div>
<div class="propslist"><span>Tip proprietate- </span> <span class="propval"><?php echo get_the_term_list( $post->ID, \'property\', \'\', \' \', \'\' ); ?></span></div>
<div class="propslist"><span>Camere - </span> <span class="propval"> <?php echo get_the_term_list( $post->ID, \'bedrooms\', \'\', \' \', \'\' ); ?></span></div>
<div class="propslist"><span>Băi - </span> <span class="propval"> <?php $bath=get_post_meta($post->ID, \'wtf_bath\', true); echo $bath; ?></span></div>
<div class="propslist"><span>Garaj - </span> <span class="propval"> <?php $garage=get_post_meta($post->ID, \'wtf_garage\', true); echo $garage; ?></span></div>
<div class="propslist"><span>Pret- </span> <span class="propval"> <?php $price=get_post_meta($post->ID, \'wtf_price\', true); echo $price; ?></span></div>
<div class="propslist"><span>Suprafata- </span> <span class="propval"> <?php $suprafata=get_post_meta($post->ID, \'wtf_suprafata\', true); echo $suprafata; ?></span></div>
</div>
我想如果输入数据为空,我不想在主div中显示
例如,如果锡槽输入数据为空,我希望:
<div class="propslist"><span>Băi - </span> <span class="propval"> <?php $bath=get_post_meta($post->ID, \'wtf_bath\', true); echo $bath; ?></span></div>
不再出现