axxe16
7/5/2017 - 9:52 AM

recupera la tassonomia dato l'id dell'elemento. Restituisce un array qui prendo il primo. #taxonomy #term #terms #termbyid

recupera la tassonomia dato l'id dell'elemento. Restituisce un array qui prendo il primo. #taxonomy #term #terms #termbyid

<?php
$id = $id_corrente = get_the_ID();
$taxonomy = 'classi';
$terms = get_the_terms( $id, $taxonomy );
$nome = $terms[0]->name;
$link = get_term_link($terms[0]->term_id);
echo "<a class=\"classeGruppo\" href=\"$link\">$nome</a>";