Skip to content

Instantly share code, notes, and snippets.

@WebEndevSnippets
Created November 6, 2012 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WebEndevSnippets/4024874 to your computer and use it in GitHub Desktop.
Save WebEndevSnippets/4024874 to your computer and use it in GitHub Desktop.
WordPress: Customize Excerpt 'Read More' (including manual excerpts)
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('[...]', '&nbsp;<a class="more-link" href="'.get_permalink().'">[More&#x2026;]</a>', $text), "<a>");
} else {
$excerpt = '' . $text . '&nbsp;<a class="more-link" href="'.get_permalink().'">[More&#x2026;]</a>';
}
return $excerpt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment