Created
November 6, 2012 13:57
-
-
Save WebEndevSnippets/4024874 to your computer and use it in GitHub Desktop.
WordPress: Customize Excerpt 'Read More' (including manual excerpts)
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
add_filter( 'get_the_excerpt', 'webendev_custom_excerpt' ); | |
/** | |
* Customize Excerpt 'Read More' (including manual excerpts) | |
* | |
*/ | |
function webendev_custom_excerpt($text) { | |
if (strpos( $text, '[...]' ) ) { | |
$excerpt = strip_tags(str_replace('[...]', ' <a class="more-link" href="'.get_permalink().'">[More…]</a>', $text), "<a>"); | |
} else { | |
$excerpt = '' . $text . ' <a class="more-link" href="'.get_permalink().'">[More…]</a>'; | |
} | |
return $excerpt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment