PSD to HTML conversion PSD to HTML conversion PSD2HTML.com with over 300 professionals takes the designs to HTML and beyond

Code Snippet

Home » Code Snippets » WordPress » Replace Excerpt Ellipsis with Permalink

Replace Excerpt Ellipsis with Permalink

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');

Subscribe to The Thread

  1. Very useful, tried and tested, thanks.

  2. Useful snippet, thanks!

  3. where do yo place this function?

  4. I’ve been using:

    function new_excerpt_more($more) {
    global $post;
    return ‘… a class=”more-link” href=”‘. get_permalink($post->ID) . ‘”>’ . ‘Read More »’ . ‘/a’;
    }
    add_filter(‘excerpt_more’, ‘new_excerpt_more’);

    But it kept showing the ” … ” at the end of the post.
    This is much cleaner. Thanks!

  5. Hello,
    Thank you for all your tricks, you save us so much time!

    Any impact on SEO when using this one please?

    Regards,

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~