Reading Time Plugin Breaking

I’m using the Reading Time PHP plug in found here
When i include it in my article php template gives me the error: Undefined property: Page::$text

Here is the code:
<?php

	$content	= $page->text; 
	$words		= str_word_count(strip_tags($content));
	$m 		= floor($words / 200);
	$s 		= floor($words % 200 / (200 / 60));
	//$estimate 	= $m . ' ' . ($m == 0 ? 'minuten' : '') . ($m == 1 ? 'minuut' : '') . ($m >= 2 ? 'minuten' : '') . ', ' . $s . ' seconde' . ($s == 1 ? '' : 'n');
	$estimate 	= $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's');

?>
 
Estimated reading time: <?php echo $estimate; ?>

Should be $content = $page->text();

1 Like

Worked perfectly. Thank you! :slight_smile:

I’ve made a PHP class for reading time as well. It’s not a Kirby plugin but it should be really easy to use it with Kirby.

If someone would like to make a plugin out of it, you are so welcome!