How to remove the ellepsis in wordpress excerpt , and add continue reading post link ?

When the default wordpress excerpt is shown, it ends with an ellepsis […]

How to remove that and replace it and add a link to the post like , continue reading some post title.

Here is how to do it

Add this to your themes functions.php

function mod_the_excerpt($text)
{ 
	//return str_replace('[...]', '<a href="'.get_permalink().'>Continue Reading '.get_the_title().'</a>...', $text); 
	return str_replace('[&hellip;]', '<a href="'.get_permalink().'">Continue Reading </a>...', $text); 
	
} 
add_filter('the_excerpt', 'mod_the_excerpt');

In some themes the text to be replaced is […] and in others it is

[&hellip;]

so you will have to judiciously see the string that requires replacement in the first argument of the str_replace function. Use view page source to see the actual text of the ellipsis that requires replacement.



That is all.

If you liked this article please do leave a reply and share it with friends.

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.