wordpress Replace Excerpt Ellipsis with Permalink

by in , 0

This is useful if you would like to replace the ellipsis [...] from the excerpt with a permalink to the post.

functions.php addition:

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

Leave a Reply