Created
June 17, 2013 16:52
-
-
Save CEscorcio/5798361 to your computer and use it in GitHub Desktop.
Limit excerpt and change read more text
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
functions.php | |
function get_excerpt($count){ | |
$permalink = get_permalink($post->ID); | |
$excerpt = get_the_content(); | |
$excerpt = strip_tags($excerpt); | |
$excerpt = substr($excerpt, 0, $count); | |
$excerpt = substr($excerpt, 0, strripos($excerpt, " ")); | |
$excerpt = '<p>'.$excerpt.'... </br><a href="'.$permalink.'">Read more more</a></p>'; | |
return $excerpt; | |
} | |
template.php | |
<?php echo get_excerpt(325); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment