getting term links in page template
-
Hi all. I’m fixing a page-template for a recruitment website. Each vacancy comes with a list of terms. (see for an example: https://cygnific.accptwerven.nl/?vacancy=sales-manager-b2b-fulltime) But I want these terms to be a link. This is the code so far:
<?php $taxonomies = get_object_taxonomies( 'vacancy' ) ?> <?php if( $taxonomies ) : ?> <table class="table table-striped"> <tbody> <?php foreach( $taxonomies as $taxonomy_slug ) : ?> <?php $taxonomy = get_taxonomy( $taxonomy_slug ); ?> <?php $terms = wp_get_object_terms( get_the_ID(), $taxonomy_slug ); ?> <?php if( count( $terms ) ) : ?> <tr> <td><?php echo $taxonomy->labels->singular_name ?></td> <td> <?php $term_list = array(); foreach( $terms as $term ) { $term_list[] = $term->name; } echo implode( ", ", $term_list ); ?> </td> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> <?php endif; ?>
I know I should use get_term_link function, but I do not know where to put it… Hope somebody can help me out?
- The topic ‘getting term links in page template’ is closed to new replies.