1:打开相应主题的function.php 2:在<?php ?>中加入以下代码 /// 函数名称:post_views /// 函数作用:取得文章的阅读次数 function post_views($before = '(点击 ', $after = ' 次)', $echo = 1) { global $post; $post_ID = $post->ID; $views = (int)get_post_meta($post_ID, 'views', true); if ($echo) echo $before, number_format($views), $after; else return $views; } 3.在需要显示的地方调用此函数,代码如下:阅读:<?php post_views('', '次'); ?> ...
