Support

Account

Forum Replies Created

  • Solved in this way:

    <?php $term_list = wp_get_post_terms($post->ID, 'term_name', array("fields" => "all")); ?>
                        <strong>Term name</strong> <?php echo $term_list[0]->name ; ?> 

    If you want to display a term in a if statement:

    <?php if( get_terms('term_name') ): ?>
                    <?php $term_list = wp_get_post_terms($post->ID, 'term_name', array("fields" => "all")); ?>
                        <p><strong>Term name</strong> <?php echo $term_list[0]->name ; ?></p>
                    <?php endif; ?>
  • Hi James.
    I tried following code:

     <p>
         <?php $variable = get_field('variable', false, false); ?>
         <strong>Term</strong> <?php echo $variable; ?> </p>

    but I have no results

    If I try

    <p>
         <strong>Variable</strong> <?php the_terms($post->ID, 'variable' ); ?> </p>

    it works, but the term is displayed with a link
    Any suggest?

Viewing 2 posts - 1 through 2 (of 2 total)