Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm pretty new to functions and PHP but here's what I would like to to:
I would like to truncate the title of an article teaser to 48 characters (and preferably follow the truncated title with an ellipsis). I found a code snippet here which I have adapted, but am struggling to ascertain where to insert the code in my Omega subtheme - I've tried sites/all/themes/subtheme/template.php but it seems to have no effect. Please could you share your wisdom with me?
function THEMENAME_preprocess_node(&$variables) {
if ($variables['type'] == 'article' && $variables['view_mode'] == 'teaser') {
$variables['title'] = truncate_utf8($variables['title'], 48, TRUE, TRUE);
}
}
Thanks!
A~
Comments
Comment #1
Aptalops CreditAttribution: Aptalops commentedI'm closing this question because I think it's a display suite issue rather than an Omega one.
Have asked again here: https://www.drupal.org/node/2357179