官方文档:
== Installation ==
1. Open `wp-content/plugins` Folder
2. Put: `Folder: wp-postviews`
3. Activate `WP-PostViews` Plugin
4. Go to `WP-Admin -> Settings -> PostViews` to configure the plugin.
= Usage =
1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`
2. You may place it in archive.php, single.php, post.php or page.php also.
3. Find: `<?php while (have_posts()) : the_post(); ?>`
4. Add Anywhere Below It (The Place You Want The Views To Show): `<?php if(function_exists('the_views')) { the_views(); } ?>`
5. Or you can use the shortcode `[views]` or `[views id="1"]` (where 1 is the post ID) in a post
安装:
把下载解压的文件夹放到wp-content/plugins/下边
然后去WordPress的后台启用这个插件。这样可以用了,只完成了官方文档中的安装,但是在页面上还没显示。
显示:
找到你当前主题的文件夹,我的是twentysixteen
改index.php
在index.php下Ctrl+F找这段代码
while (have_posts()) : the_post();
添加这一段代码
if(function_exists('the_views')) { the_views(); }
要放在循环里边
如果需要还可以自己修改其他的文件
样例: