2

How could I detect if node type is article (in template.php) but process variables only for teaser of article, not article i full mode. (I have template suggestions so i have node--article-teaser.tpl.php). Like:

if ($node->type == 'article' and inject only if article-teaser.tpl.php)

Thanks!

1 Answer 1

2

In a preprocess/process function for the node template file, you just need to check the following variables:

  • $variables['teaser'] must be TRUE
  • $variables['node']->type must be 'article'

$variables is the parameter passed to preprocess/process functions.

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.