Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fikrirasyid/4c384e79b8f88b06c45c to your computer and use it in GitHub Desktop.
Save fikrirasyid/4c384e79b8f88b06c45c to your computer and use it in GitHub Desktop.
WordPress: replace the_excerpt's [...] + change its words length
/**
* Modifying excerpt's length
*
* @return int
*/
function yourtheme_excerpt_length(){
return 20;
}
add_filter( 'excerpt_length', 'yourtheme_excerpt_length' );
/**
* Replacing excerpt's […]
*
* @return string
*/
function yourtheme_excerpt_more(){
return ' …';
}
add_filter( 'excerpt_more', 'yourtheme_excerpt_more' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment