• Hello I was wondering if someone could help me out. I am creating a single.php page with custom meta data. I would like the custom post type associated with the single.php to display this custom meta. i would like to have an if statement so that only specific meta data will display if the custom post type is associated with a specific taxonomy.

    <?php
    if(taxonomy_exists('websites')){
         echo ' get_post_meta($post->ID, 'Website_URL', true)';
    }
    else{
    
    echo ' get_post_meta($post->ID, 'Website_URL',false)';
    
    }
    ?>

    but would like this to be enclosed in a ul li like:

    <ul class='post_meta'>
    <li><span class='post-meta'>name:</span> <?php echo get_post_meta($post->ID, 'name', true); ?></li>
    <li><span class='post-meta-key'> Description:</span> <?php echo get_post_meta($post->ID, 'short', true); ?></li>
    <li><span class='post-meta-key'>  <?php
    if(taxonomy_exists('websites')){
         echo ' get_post_meta($post->ID, 'Website_URL', true)';
    }
    else{
    
    echo ' get_post_meta($post->ID, 'Website_URL',false)';
    
    }
    ?>     </li>
    </ul>
  • The topic ‘if taxonomy exist’ is closed to new replies.