Add Read More Link to WordPress Post Excerpts

How to Add Read More Link to WordPress Post Excerpts

in Functions
Google+ LinkedIn

The WordPress Excerpt is an optional summary or description of a post; in short, a post summary. One of the wonderful thing about Excerpt is that it replaces the full content in RSS feeds when the option to display summaries is selected in reading settings. Usually bloggers use excerpts on post stream and archive pages to display a short meaningful description of full article. However unlike post content, at the end of the excerpt, a standard […] appears instead of read more link. The problem is that since it doesn’t add read more link at the end of the post summary, some readers does not know how to continue to full article and might leave. It could possibly lead to increase bounce rate on your website.

Earlier we have shown you how to change the post excerpt length and have custom excerpt length for different categories, in this article we will show you how to add read more link to post excerpts.

If you also use post excerpt to display summary on post stream pages and archive pages then this code snippet will help you. Just paste this code snippet in your theme’s functions.php file. This snippet will tell WordPress to add read more link instead of the standard […].

// add read more link to wordpress post excerpts
function wcs_add_excerpt_more_link( $more ) {
    global $post;
    return '... <a class="more-link" href="' . get_permalink( $post->ID ) . '">' . __( 'Read More', 'wpcodesnippet' ) . '</a>';
}
add_filter( 'excerpt_more', 'wcs_add_excerpt_more_link' );

Share the love

If you like this snippet, share it with others!

Leave a Reply

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