Support

Account

Home Forums Front-end Issues Help Please: Links in the category of custom fields Reply To: Help Please: Links in the category of custom fields

  • Hi @wilfredo123

    The use of get_term_link and passing in the term item should do the trick for you for getting the link.

    You can try the code below… I setup a counter in the test code to be sure not to have a comma at the end of your list. It should display as shown in your image, but please test it for bugs.

    Hope this helps! Let me know.

    
    <?php
    $empresa_terms = get_field( 'empresa' );
    if ( $empresa_terms ) {
      $total = count( $empresa_terms );
      $count = 1;
      echo 'Places: ';
      foreach ( $empresa_terms as $empresa_term ) {
        echo '<a href="' . get_term_link( $empresa_term ) . '">';
        echo $empresa_term->name;
        echo '</a>';
        if ( $count < $total ) {
          echo ', ';
        }
        $count++;
      }
    }
    ?>