document.writeln('');
1、在主題目錄下functions.php文件把下面的代碼添加進去:
// 文章字數和閱讀時間function count_words_read_time () {global $post;$text_num = mb_strlen(preg_replace(/s/,,html_entity_decode(strip_tags($post->post_content))),UTF-8);$read_time = ceil($text_num/300); // 修改數字300調整時間$output .= 共計 . $text_num . 字,閱讀大約 . $read_time . 分鐘。;return $output;}// 文章字數和閱讀時間 function count_words_read_time () { global $post; $text_num = mb_strlen(preg_replace(/s/,,html_entity_decode(strip_tags($post->post_content))),UTF-8); $read_time = ceil($text_num/300); // 修改數字300調整時間 $output .= 共計 . $text_num . 字,閱讀大約 . $read_time . 分鐘。; return $output; }//文章字數和閱讀時間function count_words_read_time () {global $post;$text_num = mb_strlen(preg_replace(/s/,,html_entity_decode(strip_tags($post->post_content))),UTF-8);$read_time = ceil($text_num/300); // 修改數字300調整時間$output .= 共計 . $text_num . 字,閱讀大約 . $read_time. 分鐘。;return $output;}
2、在主題目錄zibll/inc/functions/zib-single.php,把下面代碼添加到132行處(如下圖)
<!--文章字數和閱讀時間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?><!--文章字數和閱讀時間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?><!--文章字數和閱讀時間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?>
說明:(必看)文章字數和閱讀時間都不是很準,同時用處也不是很大…喜歡的話自己拿去試試吧!