diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


How to display excerpt in WordPress? Customizing the “Read More” tag

Over the course of time, I’ve been receiving lots of queries, “how I’m displaying, “random, latest, previous posts”, and “excerpts”. I’ve responded those queries many times, so I thought to explain each queries on a seperate blog post to help the users.

In this post, I’m going to explain “More Tag”. As you can see, I’m using excerpts on my index / archive page, and full contents are displayed on single page only. To get the excerpt on my index /archive pages, I’m using a plugin for the past 3+ years, called “Excerpt Reloaded”.

If you don’t want to use seperate plugin for excerpts, you can use the_content function with <!–more–> tag at the point, which you want to prompt readers to click on a link to “read more,” or simply use the_excerpt funtion. But there’s a problem with this function, when you click on the “read more” link, the web page loads and then “jumps” to the section, where the <!–more–> tag is placed in the post. If you do not want “jump”, you can change the default functionality of how this function works by editing the following line in wp-includes/post-template.php:

Open your file and search for the following code:

$output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";

….change to:

$output .= ' <a href="'. get_permalink()

Note: If you follow above steps, you’ll have to do this manual adjustment, every time you upgrade WordPress. On a safe bet, it’s advisable to use Excerpt Reloaded plugin, which offers many customization.

Share This Story, Choose Your Platform!

Get Latest News

Subscribe to Digital News Hub

Get our daily newsletter about the latest news in the industry.
First Name
Last Name
Email address
Secure and Spam free...