文章页面添加文章字数和阅读时间

美化教程

1、文章文章在主题目录下functions.php文件把下面的页面代码添加进去:

// 文章字数和阅读时间 function count_words_<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/710.html" title="View all posts in read">read</a>_<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/711.html" title="View all posts in time">time</a>(){ global $<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/712.html" title="View all posts in post">post</a>; $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_<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/710.html" title="View all posts in read">read</a>_<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/711.html" title="View all posts in time">time</a> () { global $<a target="_blank" href="https://www.kaiyuanyuanma.com/tag/712.html" title="View all posts in post">post</a>; $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(); ?>

阐释:(必看)文章字数和阅读时间都不是很准,同时用处也不是和阅很大…喜爱的话自己拿去试试吧!

文章文章内容看完了
皖ICP备2025077989号-141