Trim Your Text with wp_trim_words() in WordPress

Today, I discovered that WordPress 3.3 actually has a similar core function called wp_trim_words().

The function works like so:

<?php wp_trim_words( $text, $num_words = 55, $more = null ); ?>

 

 php echo wp_trim_words( get_the_content(), 100, '...' );

Revisions

Tags: ,

No comments yet.

Leave a Reply