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.

1 Answer 1

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 and acknowledge you have read our privacy policy.

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