Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Forums excerpt and description?


Olaf Lederer
Participant

@finalwebsites

Maybe you can shorten the desription using this custom php function?

if (!function_exists('substring_words')) {
function substring_words($str, $txt_len, $prefix = ' [...]') {
$words = explode(' ', $str);
$count = 0;
$new_str = '';
$abbr = '';
foreach ($words as $val) {
if ($count < $txt_len) {
$new_str .= $val.' ';
$count = $count + strlen($val);
}
}
$new_str = rtrim($new_str, ' ,.;:');
$new_str .= (strlen($str) > $txt_len) ? $prefix : '';
return $new_str;
}
}

Skip to toolbar