Support » Fixing WordPress » Help with conditional statement for custom taxonomy

  • Resolved Daniella

    (@ellaj)


    Hi,
    On a custom post page template I need to list the custom taxonomies associated with that post. Some of the custom posts have different taxonomy terms and some have none. So if they don’t have a taxonomy term associated with it then I don’t want the title to show. The following code is omitting all the information, even if there are terms associated with a taxonomy:

    <?php  if(taxonomy_exists('','attractions','')) { ?>
    <div>
    <h2>Attractions</h2>
    <?php echo get_the_term_list( $post->ID, 'attractions', ' ', ' | ', '' ); ?>
    </div>
    <?php } ?>

    Could someone please help?
    Thank you!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Help with conditional statement for custom taxonomy’ is closed to new replies.