meta-ert.php 584 B

12345678910111213141516
  1. <?php
  2. function get_meta_estimate_reading_time()
  3. {
  4. $words_count = get_post_meta(get_the_ID(), 'post_words_count', true);
  5. if ($words_count) {
  6. $ert = round($words_count / 220);
  7. if ($ert < 1) {
  8. return __("Less than 1 minute", "sakurairo");
  9. } else if ($ert > 60) {
  10. $hour = round($ert / 60);
  11. return sprintf(_n('%s Hour', '%s Hours', $hour, "sakurairo"), number_format_i18n($hour));
  12. } else {
  13. return sprintf(_n('%s Minute', '%s Minutes', $ert, "sakurairo"), number_format_i18n($ert));
  14. }
  15. }
  16. }