This is an efficient plugin which tracks all single-post views. It saves the data as post meta data which can easily be updated if needed. The view count can be seen on the grid on the post screen. The plugin also provides an easy way to get the top post data and use in other plugins or theme files (see below). WordPress high-volume tested.
- Go to Admin – Plugins – Add New and search for “Better Postviews”
- Click on Install
- Click on Activate
- Download better-postviews.zip
- Unzip and upload the “better-postviews” folder to your “/wp-content/plugins/” directory
- Activate the plugin through the “Plugins” menu in WordPress
This plugin will work out-of-the-box – no configuration is necessary and there is no admin interface. However, it might be necessary to modify a few options (in the code) for a better experience.
- To disable tracking but retain the output, change “true” to “false” on line 13 of better-postviews.php
- To disable the post column view but retain tracking, change “true” to “false” on line 14 of better-postviews.php
- To enable a debug output in comments at the bottom of your sites source code, change “false” to “true” on line 15 of better-postviews.php
- To increase or decrease the transient lifetime of the top-one, top-three, and top-five data, change “300” on line 16 to a value of your choice
- To use the top-one, top-three, or top-five data elsewhere, simply call better_postviews::get_top_one(), better_postviews::get_top_three(), or better_postviews::get_top_five() and it will return an array of post IDs with element 0 being greatest – prepped and ready for your custom WP_Query!
- Will add get_top_five_count or something similar in the future.
Contributors & Developers
“Better Postviews” is open source software. The following people have contributed to this plugin.Contributors
- Added several filters to give developers more control
- Fixing readme.txt markup
- Initial submission of plugin files