theme - 5

判断taxonomy有没有设置值:

 1         <div class="entry-meta-custom">
 2             <?php if (get_the_term_list( $post->ID, 'meal-type' ) != null ) { ?>
 3                 <div>Meal type: <?php echo get_the_term_list( $post->ID, 'meal-type', '', ', ', '' ); ?></div>
 4             <?php } ?>
 5             <?php if (get_the_term_list( $post->ID, 'time' ) != null ) { ?>
 6                 <div>Preparation time: <?php echo get_the_term_list( $post->ID, 'time', '', ', ', '' ); ?></div>
 7             <?php } ?>
 8             <?php if (get_the_term_list( $post->ID, 'servings' ) != null ) { ?>
 9                 <div>Servings: <?php echo get_the_term_list( $post->ID, 'servings', '', ', ', '' ); ?></div>
10             <?php } ?>
11             <?php if (get_the_term_list( $post->ID, 'difficulty' ) != null ) { ?>
12                 <div>Difficulty: <?php echo get_the_term_list( $post->ID, 'difficulty', '', ', ', '' ); ?></div>
13             <?php } ?>
14             <?php if (get_the_term_list( $post->ID, 'ingredients' ) != null ) { ?>
15                 <div>Ingredients: <?php echo get_the_term_list( $post->ID, 'ingredients', '', ', ', '' ); ?></div>
16             <?php } ?>
17         </div><!-- .entry-meta-custom -->

posted on 2012-08-29 11:54  kalintw  阅读(88)  评论(0)    收藏  举报

导航