Last active
October 26, 2018 13:08
-
-
Save omniacode/c059d1f3e7a47879da651cc464824558 to your computer and use it in GitHub Desktop.
Custom Wordpress Excerpt (Word Count)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'get_the_excerpt', 'custom_excerpt_length' ); | |
function custom_excerpt_length( $content ) { | |
$length = 8; | |
$content = wp_trim_words( $content, $length, '...' ); | |
return $content; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment