Support » Fixing WordPress » Custom Taxonomy Conditional – Output code only if taxonomy has a value

  • Resolved ruhelamin

    (@ruhelamin)


    Hi, im using Custom Taxonomies in my theme, for example:

    <?php echo get_the_term_list( $post->ID, 'people', 'People: ', ', ', '' ); ?>

    Is it possible to do a conditional statement to output some code only if that taxonomy has a value/term entered in it in the admin posts page.

    For example:

    IF taxonomy has a value then output this:

    <dt>Gender: </dt>
          <dd><?php echo get_the_term_list( $post->ID, 'gender', '', ' / ', '' ); ?><span></span></dd>

    ELSE (if it has no values) then output NOTHING!

    Is this possible? Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Taxonomy Conditional – Output code only if taxonomy has a value’ is closed to new replies.