Use of Taxonomy in Teaser

mattie's picture
mattie
Fri, 03/15/2013 - 12:52
#1
Use of Taxonomy in Teaser

I've created a taxonomy vocabulary to identify *types* of articles:

Type of Article (Vocabulary Terms)

NOTE: In the image above, the taxonomy term "Article" refers to a news story -- not the Drupal usage.

I'd like the taxonomy term assigned to a node to prepend the teaser description on the front end like so:

Taxonomy in Teaser Description

 

I've approprately attached this taxonomy vocabulary to the content type. How and where do I integrate this customization?

Neo's picture
Neo
Sat, 03/16/2013 - 08:41

You need to make some custom code into node--[type].tpl.php

replace print render($content); with this code:

$typeOfArticle = taxonomy_term_load($node->field_category['und'][0]['tid']);

print $typeOfArticle->name . ' - ';

print $node->body['und'][0]['value'];

remember to change field_category to your taxonomy field

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.