Hi Tom. I want to show this <div class="reading-time">Time To Read: <?php echo reading_time(); ?><div>
next to the byline on single posts (and then float it right with CSS). Would you kindly help me with a function to do that? I want them to appear on a straight line because using the element after entry title does not help and I had to adjust the top margin using CSS which looks out of line on minimal devices.
Here is the reading time function.
function reading_time() {
$content = get_post_field( 'post_content', $post->ID );
$word_count = str_word_count( strip_tags( $content ) );
$readingtime = ceil($word_count / 250);
if ($readingtime == 1) {
$timer = " minute";
} else {
$timer = " minutes";
}
$totalreadingtime = $readingtime . $timer;
return $totalreadingtime;
GeneratePress 2.2.2
GP Premium 1.7.8