2012-02-06, 01:18:06
SG Wrote:Hi, anyone knows how to make the excerpt doesn't cut by letter ?
Code:apple pie i...
I need it to cut by word, so it's still readable
Code:apple pie is...
You can try to replace nm_create_excerpt function in the functions.php file by this code:
Code:
function nm_create_excerpt($content, $slug){
global $NMEXCERPTLENGTH;
$len = intval($NMEXCERPTLENGTH);
$content = strip_tags($content);
$url = nm_get_url('post') . $slug;
if (strlen($content) > $len){
while ($content[$len] != " " && ++$len < strlen($content)){
$excerpt = substr($content,0,$len).'... <a href="'.$url.'">read more</a>';
}
}
else
$excerpt = $content.' <a href="'.$url.'">read more</a>';
return "<p>$excerpt</p>";
}
and also change line 99 in nm_show_post function in the site.php file to:
Code:
if ($excerpt) $content = nm_create_excerpt($content, $slug);