If you’re running a WordPress site, you may be wondering how to add read time estimate to your posts. Fortunately, it’s quite straightforward.
Reading time estimates have become a staple on many leading blogs and online publications. These indicators provide readers with an idea of how much time they’ll need to invest in a particular article, helping them manage their time more efficiently.
Why Add a Reading Time Estimate?
Before diving into the how-to, let’s discuss the why. Adding a reading time estimate can:
- Enhance User Experience (UX): Knowing how long an article will take can help readers decide whether to engage now or save it for later.
- Boost Engagement: When readers know the time commitment upfront, they’re less likely to bounce midway through reading.
- Improve SEO: Enhanced UX and engagement metrics can positively impact your search rankings.
How to Implement Read Time Estimates in WordPress
There are mainly two methods to add a reading time estimate: using a plugin or adding custom code.
1. Using a Plugin:
For those who prefer a hassle-free method, plugins are the way to go. Here are some recommendations:
- Reading Time WP
- : This is a popular, lightweight plugin. Simply install and activate it from your WordPress dashboard, and it will automatically add reading time estimates to your posts.
- Worth The Read: Another excellent choice, this plugin not only gives an estimate but also provides a progress bar as readers scroll down.
How to set it up using Reading Time WP:
- Go to ‘Plugins’ in your WordPress dashboard and click ‘Add New’.
- Search for ‘Reading Time WP’.
- Install and activate the plugin.
- Navigate to the plugin settings to customize how the reading time is displayed.
2. Adding Custom Code:
If you’re comfortable with coding and want more control over how the reading time is displayed, you can opt for this method. Here’s a basic way to calculate and display reading time:
function reading_time() {
$content = get_post_field( 'post_content', get_the_ID() );
$word_count = str_word_count( strip_tags( $content ) );
$readingtime = ceil($word_count / 200); // Assume an average reading speed of 200 words per minute.
$totalreadingtime = sprintf( _n('%d minute', '%d minutes', $readingtime), $readingtime );
return $totalreadingtime;
}
Add this function to your theme’s functions.php
file. Then, where you want to display the reading time (e.g., in your single.php or content.php file), use:
echo reading_time();
Conclusion
Adding a reading time estimate to your WordPress posts can significantly improve the UX of your website.
Whether you’re using a plugin or integrating custom code, this feature can help set clear expectations for your readers and potentially increase engagement.