1

I have an Entity taxonomy Reference field in my content type.

I need to print parent of the term linked to my node in node.tpl.php (link to that term). How can I do it?

Thanks for your help.

0

Ok, I figured it out. This is my code:

<?php
    $term = field_get_items('node', $node, 'field_taxonomy_term');
    $parent = current(taxonomy_get_parents($field[0]['target_id']));
    print l($parent->name, 'taxonomy/term/'. $parent->tid);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.