Excerpts can do wonders to your blog if showcased properly. In the last post about how to show excerpt in WordPress themes, we discussed that how they helps to improve CTR, reduces bounce rate and improves SEO then we saw how to change the default excerpt length to display a meaningful gist of the post to your visitors.
This post is all about read more link in excerpts. As we all know that excerpt should have a link to the post’s full content so here we are sharing few codes, which adds a read more link to a excerpt, in order to re-direct visitors to the full content.
This is how it looks:
How to add read more link to your WordPress theme?
I have provided several codes for various types of read more link, choose the one which you like and paste the corresponding code to the theme’s functions.php file.
Link type 1: Read More »
/* Link Style 1 */ function new_excerpt_more($more) { global $post; return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More »' . '</a>'; } add_filter('excerpt_more', 'new_excerpt_more');
Link type 2: Read More ›
/* Link Style 2 */ function new_excerpt_more($more) { global $post; return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More ›' . '</a>'; } add_filter('excerpt_more', 'new_excerpt_more');
Link type 3: Read More →
/* Link Style 3 */ function new_excerpt_more($more) { global $post; return '… <a href="'. get_permalink($post->ID) . '">' . 'Read More ›' . '</a>'; } add_filter('excerpt_more', 'new_excerpt_more');
If you notice, the screenshot I provided in the post doesn’t have a read more text instead it has a “Read the full article” text. You can also change the text to the one you like, by modifying the above provided code snippets. Wonder how to do?
Search the below code in above functions and replace it
Read More ›
With this one
Read the full article ›
That’s all I have for this topic. Let me know if you need any assistance while setting up the code into WordPress theme files.
Leave a Reply