Display Reading Time
Display Reading Time for posts and give readers an idea of how long it will take to read an article.
<?php
$reading_speed = 200; // 200 words per minute
$content = get_post_field( 'post_content', get_the_id() );
$word_count = str_word_count( strip_tags( $content ) );
$reading_time = ceil( $word_count / $reading_speed );
echo '<p>Estimated reading time: ' . absint( $reading_time ) . ' ' . _n( 'minute', 'minutes', $reading_time ) . '</p>';
Post Comment