mrkeck Sharing the Love

19Jan/140

Make the ellipsis clickable in WordPress

At the end of the excerpt summary it has a [...] but it doesn't link to anything. The code below makes it a link and changes [...] to [Read More].

Add this code to the functions.php

function replace_ellip($content) {
  return str_replace('[…]',
    '<a href="'. get_permalink() .'" class="more-link">[Read More]</a>',
      $content
  );
}
add_filter('the_excerpt', 'replace_ellip');
Filed under: PHP, wordpress Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.