Last active
August 29, 2015 14:03
-
-
Save jeffcdavis/57b7361ecbf441fab563 to your computer and use it in GitHub Desktop.
Custom WordPress excerpt length and read more link
This file contains hidden or 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 | |
function custom_read_more() { | |
return ' <a class="read-more" href="'.get_permalink(get_the_ID()).'">[…]</a>'; | |
} | |
function excerpt($limit) { | |
return wp_trim_words(get_the_excerpt(), $limit, custom_read_more()); | |
} | |
/* | |
use excerpt(25) or whatever length you would like | |
you can also change the read more in the function to fit your needs | |
*/ | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment