WordPress tip: Replace excerpt ellipsis with post permalink

March 5, 2012 at 5:26 pm

Today, here is an useful snippet to replace the ellipsis […] from the excerpt with a permalink to the post.

Paste the following code into your functions.php file. Once saved, the tip will be applied to your blog.

function replace_excerpt($content) {
       return str_replace('[...]',
               '... <div class="more-link"><a href="'. get_permalink() .'">Continue Reading</a></div>',
add_filter('the_excerpt', 'replace_excerpt');

Thanks to CSS Tricks for the great snippet!