beginnersbook.com

  • Home
  • All Tutorials
    • Learn Servlet
    • Learn JSP
    • Learn JSTL
    • Learn C
    • Learn C++
    • Learn MongoDB
    • Learn XML
    • Learn Python
    • Learn Perl
    • Learn Kotlin
    • Learn jQuery
  • Core Java
  • OOPs
  • Collections
  • Java I/O
  • JSON
  • DBMS

How to Display a Read More link in WordPress Excerpts

By Chaitanya Singh | Filed Under: WordPress

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:

Read More link in WordPress Excerpts

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 &raquo;' . '</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 &rsaquo;' . '</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 &rsaquo;' . '</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 &rsaquo;

With this one

Read the full article &rsaquo;

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 Cancel reply

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

SEO

  • Write SEO Articles
  • Open Graph Meta Tags
  • SEO Friendly Images
  • SEOPressor Review
  • Auto Interlink Posts

WordPress

  • Free plugins to add Open Graph Tags
  • Free plugins to add Captcha
  • Set thumbnails automatically
  • Display related Posts WP
  • Change Post excerpt length WP

Website

  • Add Facebook like button
  • Add Google plus button
  • Add Twitter button
  • Create Free Website on blogspot

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap