document.writeln('');
1、在主題目錄下functions.php文件把下面的代碼添加進(jìn)去:
// 文章字?jǐn)?shù)和閱讀時(shí)間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); // 修改數(shù)字300調(diào)整時(shí)間$output .= 共計(jì) . $text_num . 字,閱讀大約 . $read_time . 分鐘。;return $output;}// 文章字?jǐn)?shù)和閱讀時(shí)間 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); // 修改數(shù)字300調(diào)整時(shí)間 $output .= 共計(jì) . $text_num . 字,閱讀大約 . $read_time . 分鐘。; return $output; }//文章字?jǐn)?shù)和閱讀時(shí)間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); // 修改數(shù)字300調(diào)整時(shí)間$output .= 共計(jì) . $text_num . 字,閱讀大約 . $read_time. 分鐘。;return $output;}
2、在主題目錄zibll/inc/functions/zib-single.php,把下面代碼添加到132行處(如下圖)
<!--文章字?jǐn)?shù)和閱讀時(shí)間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?><!--文章字?jǐn)?shù)和閱讀時(shí)間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?><!--文章字?jǐn)?shù)和閱讀時(shí)間--><i class="fa fa-hourglass-start"></i> <?php echo count_words_read_time(); ?>
說明:(必看)文章字?jǐn)?shù)和閱讀時(shí)間都不是很準(zhǔn),同時(shí)用處也不是很大…喜歡的話自己拿去試試吧!