Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
function MYTHEME_preprocess_node(&$vars, $hook) {
switch($vars['node']->type) {
case 'mynode_type' :
case 'another_nodetye' :
// Dispatch with vocabs if in teaser.
if(!$vars['page']) unset($vars['terms']);
break;
}
}
<?php
/**
* This function will remove taxonomy terms from the content type "Act" when viewed in teaser mode.
*/
function MYMODULE_link_alter(&$links, $node, $comment = NULL) {
// If content type is act
if($node):
switch($node->type) {
case 'act' :
// If Teaser
if($node->teaser):
// Remove links
foreach($links as $k => $l){
unset($links[$k]);
}
endif;
break;
}
endif;
}
Comments
Comment #1
doublejosh commented+1
Comment #2
doublejosh commentedI did this in a custom module like this (meaning unfortunately content types are hard coded)...
Comment #3
doublejosh commentedThere is also a template level way like this...
Comment #4
gmaximus commentedI just tried using the method explain in #2 but it broke the site... Any ideas?
I can't do it at the theme layer because the teaser is being used to generate a email...
Thanks...
Comment #5
gmaximus commentedI got it working with this: