Source code
?>
17958
Definition:
function wp_trim_words( $text, $num_words = 55, $more = null ) {}
returns:Trimmed text.
apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text )function wp_trim_words( $text, $num_words = 55, $more = null ) {
if ( null === $more )
$more = __( '…' );
$original_text = $text;
$text = wp_strip_all_tags( $text );
$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
if ( count( $words_array ) > $num_words ) {
array_pop( $words_array );
$text = implode( ' ', $words_array );
$text = $text . $more;
} else {
$text = implode( ' ', $words_array );
}
return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
}
17872