Skip to content

Instantly share code, notes, and snippets.

@cafuego
Last active December 14, 2015 09:58
Show Gist options
  • Save cafuego/5068297 to your computer and use it in GitHub Desktop.
Save cafuego/5068297 to your computer and use it in GitHub Desktop.
_preprocess_node(&$variables) {
$terms = field_get_items('node', $variables['node'], 'field_topic');
$parents = taxonomy_get_parents($terms[0]['tid']);
$parent = array_shift($parents);
$variables['top_topic'] = field_view_value('node', $node, 'field_topic', array('tid' => $parent->tid));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment