Home › Forums › Gillion Theme › Reading time
Home › Forums › Gillion Theme › Reading time
Ah hi guys,
I have searched and searched, but i can’t seem to find where to get reading time for a blogpost. I’m sorry to bother you with this stupid question, but i’ve searched for a long time now..
Hope you can help!
Hi @nicolaivarney,
I hope you are well today and thank you for your question.
The theme automatically calculates post reading time using below code based on the number of words contained in the post.
function gillion_read_time( $string ) { $string = strip_tags($string); $string = preg_replace('/\s+/', ' ', trim($string)); $words = explode(" ", $string); $words = count($words); $min = floor($words / 200); $sec = floor($words % 200 / (200 / 60)); if( $min < 1 ) { return '1 min <span>'.esc_html__( 'read', 'gillion' ).'</span>'; } if( $sec >= 20 ) { $min++; } return $min . ' min <span>'.esc_html__( 'read', 'gillion' ).'</span>'; }
Best regards,
Shufflehound team
I’m very well!
I forgot to praise your beautiful site, thanks for the purchase – i’m gonna love it.
Ah. Is it possible to change this? My site is a food-blog, and I would like to change the reading time to be “preparation time” instead.. š
Thanks – Ill try for a bit. Thanks for reply
Have a nice day!
You are most welcome here š