carsonf92 of Speak Creative
4/8/2020 - 8:29 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);
}