Skip to content

WordPress Function to Replace Read More

By default, WordPress uses an invalid grouping of three dots inside a bracket to indicate that there is more to read on an excerpt. Many WordPress users prefer to have text showing, such as "Read More" or something more descriptive.

Using your theme's functions.php file it is easy to replace the [...] with your own words. Here's how:


//function to replace invalid ellipsis with text
function elpie_excerpt($text)
{
   return str_replace('[...]', '[Read More …]', $text);
}
add_filter('the_excerpt', 'elpie_excerpt');

The code above will output:

Read More …

Which displays as Read more ...

You can change the wording to anything you like. Just copy the code above and add it to your functions.php file in your theme.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Topic: WordPress
Tagged as: functions, PHP, WordPress themes

Share on FriendFeed

{ 3 comments… read them below or jump to the comment form to add your thoughts }

  1. 1 blehoug April 9th, 2009 at 4:30 am

    hmm. bookmarked )

  2. 2 Kevin Subba September 4th, 2009 at 8:14 am

    hi,

    I have a wordpress blog and i want to show only summery of article in category page but instead it is showing full article neither it shows [...] or Read More option. I am using Life Style theme. http://www.studiopress.com/themes I tried to find option in admin area but i didn't fine. Please kindly help me. My blog url :http://annanta.com

  3. 3 Lynne Pope September 4th, 2009 at 10:07 am Lynne Pope

    @Kevin Subba: The Life Style theme is a commercial theme and support services are provided when you purchase it. I've never bought this theme so, sorry, I can't help with it but the developer offers good support so you should use that.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.