Tiggles ツ
4/14/2020 - 6:19 PM

Read Time

A function to estimate the average reading time in minutes for selected content.

Replace "#post-content" with the ID of your content container and adjust the number 250 to your desired WPM.

function readTime() {
  var postContent = $('#post-content').text().replace(/\s+/g,' ').trim();
  var wordCount = postContent.split(' ').length;
  return Math.ceil(wordCount / 250);
}