Replacing The Ellipsis With The Post’s Permalink
Our featured WordPress tutorial for today may be a long-time classic trick. It comes from renowned CSS guru Chris Coyier of CSS-tricks, and it’s about replacing the ellipsis (…) from the excerpt with a permalink to the post.
It is a pretty short snippet and so it’s very easy to implement on your site. All it takes is to copy and paste the following code below in to your functions.php file.
function replace_excerpt($content) {
return str_replace('[...]',
'... <div><a href="'. get_permalink() .'">Continue Reading</a></div>',
$content
);
} add_filter('the_excerpt', 'replace_excerpt');
You are free to replace the Continue Reading part of the code with that of your own according to your liking.