#1063

Dominykas
Keymaster

Hi Joel!

You are talking about the right line. I think you need a function to truncate full post content.

Firstly, add this function:

function ttruncat($text,$numb) {
if (strlen($text) > $numb) {
$text = substr($text, 0, $numb);
$text = substr($text,0,strrpos($text,” “));
$etc = ” …”;
$text = $text.$etc;
}
return $text;
}

to your theme’s functions.php file.

Secondly, change this line:

$html .= apply_filters(‘the_excerpt’, get_post_field( ‘post_content’, $posts[$key][‘id’] ) );

to:

$html .= ttruncat( get_post_field( ‘post_content’, $posts[$key][‘id’] ), 150 );

Here:

get_post_field( ‘post_content’, $posts[$key][‘id’] ) – is the text (full post content)
150 – the number of characters that you want to output.

Hope this helps.

Please let me know if you have any more questions.