Here’s how you can do that. Add the following to your theme’s functions.php
template file:
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'my_custom_excerpt');
function my_custom_excerpt($text) { // Fakes an excerpt if needed
if ( '' == $text ) {
$text = get_the_content('');
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '[<a href="'. get_permalink() . '">...</a>]');
$text = implode(' ', $words);
}
}
return $text;
}
All I’ve done is remove the wp_trim_excerpt
function from the get_the_excerpt
callback, and then modified wp_trim_excerpt
into what I’ve called “my_custom_excerpt
“, just adding the link to the post around the ellipses.