Use wp_trim_words to trim your text in wordpress

Go to source

snippet :  PHPcopy
echo wp_trim_words( get_the_content(), 100 ); // post content
echo wp_trim_words( get_the_excerpt(), 100 ); // post excerpt
echo wp_trim_words( get_the_title(), 100 ); // post title

source →

snippet :  PHP: Examplecopy
$trimmed = wp_trim_words( $text, $num_words = 55, $more = null );

source →

Parameters

$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: ‘…


Use wp_trim_words to trim your text in wordpress is a post from: wpsnipp.comWordPress Snippets, Code, Hacks, 590+ for your theme, blog
which is not allowed to be copied on other sites.”

Share this post.


Use wp_trim_words to trim your text in wordpress“>Facebook | Use wp_trim_words to trim your text in wordpress“>StumbleUpon | Use wp_trim_words to trim your text in wordpress“>Delicious | Use wp_trim_words to trim your text in wordpress @wpsnipp”>Tweet It |