add_filter('the_content', function($content) { if (is_single()) {
$word_count = str_word_count(strip_tags(get_post_field('post_content', get_the_ID())));
$reading_time = ceil($word_count / 200);
$content = 'Temps de lecture estimé : ' . $reading_time . ' minute(s).' . $content;
}
return $content;
});
Created
May 21, 2025 16:30
-
-
Save cryptrz/b863ee736a771a6deabe5aeec8345bba to your computer and use it in GitHub Desktop.
Estimates the reading time for a blog post
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment