Created
January 16, 2015 02:59
-
-
Save fikrirasyid/4c384e79b8f88b06c45c to your computer and use it in GitHub Desktop.
WordPress: replace the_excerpt's [...] + change its words length
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
/** | |
* 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