Hello,
Is there a way to truncate the blog title for the enfold grid layout? Some of my titles are very long and look weird next to shorter titles in the grid format. I know how to do it for a regular theme, but it requires access to the title code in the template. I do not see the title code in the index template and I don’t want to edit the parent files.
Thank you,
Bjorn
Hi bjornwallman!
Thank you for using Enfold.
Add this on functions.php:
function limit_words($string, $word_limit){
$words = explode(" ",$string);
return implode(" ",array_splice($words,0,$word_limit)) . '...';
}
Edit config-template-builder > postslider.php, find this code on line 372:
$output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($title))."'>".$title."</a></h3>" : '';
Replace it with:
$blogtitle = limit_words($title,5);
$output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' $markup><a href='{$link}' title='".esc_attr(strip_tags($blogtitle))."'>".$blogtitle."</a></h3>" : '';
This will limit the title to 5 words. Adjust it on this line:
$blogtitle = limit_words($title,5);
Regards,
Ismael
Is there no way to do this within the child theme and without having to edit the parent theme?
Hi!
Please see – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
Regards,
Yigit
Works perfectly. Thank you very much!