אם אתה משתמש בתבנית בת, תעבוד באמצעות FTP ותכניס את הקוד הבא אל הקובץ functions.php זה אמור לעשות את העבודה.
רק תעבוד בזהירות, אם אתה עובד על אתר פעיל תעשה גיבוי לפני, כי כל תו לא נכון בקובץ הזה מפיל את האתר.
if ( ! function_exists( 'pojo_get_words_limit' ) ) {
/**
* Limit string by words.
*
* @param string $string
* @param int $word_limit
*
* @return string
*/
function pojo_get_words_limit( $string, $word_limit = 10 ) {
$words = explode( ' ', $string );
$new_string = implode( ' ', array_splice( $words, 0, $word_limit ) );
if ( $new_string !== $string ) {
$new_string .= '...';
}
return $new_string;
}
}