WordPress Tips: Change WordPress Read More Link


Update 12/2015: I’m no longer updating this post so I can’t guarantee compatibility with latest version of WordPress, your theme or plugins. Test on your Localhost first before implementing it on your live site!

In my last post, I showed you how to change the post excerpt length in WordPress. Today I’d like to share with you how you can easily change the read more link to something less ubiquitous. For instance, “…are you eager to read more?” or “…click here to read the rest of the post”… you can even add an image or HTML character entities/extended characters. Try this ‘« « « «’

Here are two easy ways to customize your WordPress read more link. If you’re looking for a really good web host for your blog, try Bluehost – I found the setup procedure and their control panel very easy to adapt to and their IT team is awesome!

Method 1: Using a WordPress Plugin.

There are several WordPress plugins that you can use to change the read more link.  I wouldn’t recommend any (unless you really hate writing code to your site!) since the couple I tried had limited functionality or didn’t work.  Search for “read more plugin” on the WordPress plugin directory and take your pick.

Method 2: Edit your template’s functions.php

This requires very little knowledge of php or html. It’s easy as copy and paste.

Step 1: Find the functions.php

There are two ways to can access your template’s function.php: WP dashboard or your cPanel. From your WordPress Dashboard, go to appearance-editor. From the right hand sidebar, choose the functions.php file.  Please note that you do not have access to the undo changes function and any saved changes are permanent!  From your cPanel, you can edit the functions.php through the file manager. In most cases you will find it in this folder path: /public_html/wp-content/themes/YOUR THEME/.  Most cPanel file managers allow you to search for the file, at least mine does!

Step 2: Edit functions.php

The next step is to copy and paste the following code to your functions.php. Where? Anywhere generally works, but try and paste it just before the end, inside the ?>. The ?> marks the end of the code in functions.php, so you want to add your code just inside that.

BUT, don’t copy the code directly to your functions.php. That’s because the fancy quotes will break your site! So you’ll need to first copy the code to Notepad, edit and make sure you don’t have fancy quotes and then copy the code to your functions.php. As, always you should test the code on your localhost; not live site, to make sure it works as intended before making changes to your live site.

Here’s the code. You need to copy and paste everything from // to ; and remember to edit the text “… on the edge of your seat? Read more!!” to whatever you want your read more text to be and make sure you don’t have any fancy quotes.

// Customizes read more link in excerpts
function new_excerpt_more($more) {
global $post;
return ' <a href="'. get_permalink($post->ID) . '">   ... on the edge of your seat? Read more! </strong> </a>'; //you can change this text to whatever you like
}
add_filter('excerpt_more', 'new_excerpt_more');

Step 3: Save functions.php

Save the functions.php file and you’re done.

Would you like more WordPress customization tips?  Leave a comment and let me know.


14 responses to “WordPress Tips: Change WordPress Read More Link”

  1. Nancy Graham Avatar
    Nancy Graham

    Thank you for WordPress coding help. Do you know any free graphic design resources??

    1. Kongo Avatar
      Kongo

      Thanks for reading, I sure do. I’ve been meaning to blog about a cool java app called colorpix and firebug, which I use on a daily basis. I’ll put that on my to-do-list.

  2. onurucuncu@live.nl Avatar
    onurucuncu@live.nl

    Hi, I just inserted the code above in the functions.php and now all of a sudden my whole website is blank, it does not work anymore. What should or can I do? Please help!

    1. Kongo Avatar

      Hi, the first thing you need to do is delete the code from your functions.php. You should not be testing code on your live site. There could be a lot of reasons why the code broke your site. Send me a link to your site and I’ve have a quick look. Are you using a premium theme?

  3. Bill Robbins Avatar
    Bill Robbins

    It looks like the single and double quotation marks in your code snippet have been converted to fancy quotes which is why your reader’s site crashed. You’ll want to swap those back to straight quotes. You might also consider using Github’s Gist service so your snippets stay correct as you do things like change themes and plugins.

    1. Kongo Avatar

      Thanks Bill for the reminder, that been on my to do list for a while now. I always use a text editor, for instance Notepad++, to edit code. Before I move the code to Pastebin or github, please first paste the code into a text editor (notepad is good) and then paste it into your fuctions.php. And always test on your localhost before going live…

  4. Mary Avatar
    Mary

    You should take down this article until you fix the problem with this. I just tried this on my website and now my whole site it down. Yes, you said I should test on my local host. But the intention of this article is to make things easier for people who are new to editing their css or html, not more complicated. I don’t even know what a localhost means, so obviously this is not meant to make anything easier for anyone. I hope other people read these comments before using the information in this article, because it’s not thought through very well.

    1. Kongo Avatar

      I hear you Mary. I’ll try and update the post when I have time. WordPress has changed a lot since I wrote the article 2 years ago and I am not sure if this still works! Again you should always test everything on your localhost before your changing stuff on your live site. And if you don’t know what is a localhost, you probably should not be making changes to your site…

  5. Rick Brady Avatar
    Rick Brady

    maaaaaaan, my site is down…

    Thank you

    1. Kongo Avatar

      Sorry to hear that.
      it’s really hard to keep the code updated and working since wordpress updates so frequently…

  6. AMAIA Avatar
    AMAIA

    CHANGE READ MORE LINK WITH CSS

    .more-link {
    text-indent: -9999px;
    line-height: 0;
    }

    .more-link::after {
    content: “Seguir Leyendo”;
    text-indent: 0;
    display: block;
    line-height: initial;
    padding: 15px;
    }

    1. Kongo Avatar

      Interesting, definitely want to try this…

  7. Yves Avatar

    Voilà le code avec les bonnes guillemets et apostrophes. Cela fonctionne parfaitement sur mon site
    // Customizes read more link in excerpts
    function new_excerpt_more($more) {
    global $post;
    return ' ID) . '"> Lire la suite → '; //you can change this text to whatever you like
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    1. Kongo Avatar

      Thanks for the share.

Leave a Reply

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