This function trims text to a certain number of words and returns the trimmed text. the simple the_content() function will not work with wp_trim_words use instead of get_the_content() function.this function takes two parameters one is function name and other one is number of words.
Syntax:
<?php $trimmed = wp_trim_words( $text, $num_words = 55, $more = null ); ?>
- $text
- (string) (required) Text to trim
- Default: None
- $num_words
- (integer) (optional) Number of words
- Default: 55
- $more
- (string) (optional) What to append if $text needs to be trimmed.
- Default: '…
No comments:
Post a Comment