Show Estimated Reading Time at Post Meta

Want to tell your readers how long it will take an article to read completely? Insert the following code into the right file (e.g., single.php or page.php) in the right place (above post meta and below post title) in your theme. It counts total words in an article and calculates time by estimating that on average a reader can read 200 words in a minute.

<?php
$mycontent = $post->post_content;
            $word = str_word_count(strip_tags($mycontent));
            $m = floor($word / 200);
            $s = floor($word % 200 / (200 / 60));
            $est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's');
?>
Default image
Gaurav Tiwari
Gaurav Tiwari is a professional graphic & web designer from New Delhi, India. gauravtiwari.org is his personal space where he writes on blogging, digital marketing, content writing, learning and business growth. Gaurav has contributed in developing more than 325 brands worldwide and while you are reading this, he's busy building a couple more.

Newsletter Updates

Enter your email address below to subscribe to our newsletter