WordPress估计文章阅读时间
有时候我们需要给来访的人一个提醒,告诉他阅读这篇文章大概需要多长时间,可以用到下面代码:
//估算阅读时间
function count_words () {
global $post;
$text = $post->post_content;
if (mb_strlen($output, 'UTF-8') < mb_strlen($text, 'UTF-8')) $output .= mb_strlen(preg_replace('/\s/','',html_entity_decode(strip_tags($post->post_conten...