Plugin / Post Views Count (Support caching plugins!)

Juliobox

Frequently Asked Questions (FAQ)

Upload the “baw-post-views-count” to the “/wp-content/plugins/” directory Activate the plugin through the “Plugins” menu in WordPress Go to settings page You can add the [post_view] shortcode to your theme template or directly in a post/page or add the widget. You can also use [most_view] in a post/page to get a top (or less, see FAQ) post most viewed
[post_view] will display the counter for the actual post, custom post or page. [post_view id=”123″] will display the counter for the post/page ID “123”. [post_view time=”day”] will display the count view of the day. So same for “week” will display count view for this week. [post_view time=”day” date=”20120213″] will display the count view for this particular day: 13th, feb 2012. “date” can not be use alone, always use “time” in the same time. [post_view time=”month” date=”201102″] will display the count view for the last year february. This mean you can play with date in your template, kind of : echo do_shortcode( ‘[post_view time=”month” date=”‘ . date( ‘Ym’, mktime( 0, 0, 0, date(“n”)-1, date(“j”), date(“Y”) ) . ‘”]’ ); // This will always display the count views of the month of last year. A shortcode named “most_view” (or “most_views” or “most_viewed”) is available. Same as [post_view], you can set “time” and “date” but also this parameters: “before”: A text before the list; default is empty “after”: A text after the list; default is empty “show”: Do we show counters ? 1= yes, 0=no; default is 1. “number”: How many posts to display ?; default is 10. “ul_class”: A CSS class “li_class”: A CSS class “order”: ‘desc’ or ‘asc’ “author”: an author ID or author name. “post_type”: post types list, comma separated, default=settings Example: – [most_view number=”3″ show=”0″ before=”Top 3!”] Will display the top 3 posts, no counters displayed, with title “Top 3!”
baw_count_views_timings: apply_filters( 'baw_count_views_timings', array( 'all'=>'', 'day'=>'Ymd', 'week'=>'YW', 'month'=>'Ym', 'year'=>'Y' ) ); You can add/remove timings with this filter, so if you do not need stats, or just do not need Year stat, you can remove them to avoid the creation of meta data unused in DB. Example: function remove_timing_for_bawpvc( $timings ) { unset( $timings[‘year’] ); // remove Year stat/meta return $timings; } add_filter( ‘baw_count_views_timings’, ‘remove_timing_for_bawpvc’ ); or function remove_timing_for_bawpvc( $timings ) { return array( ‘all’ => ” ); // keep only all counts, no other stats } add_filter( ‘baw_count_views_timings’, ‘remove_timing_for_bawpvc’ ); baw_count_views_meta_key: apply_filters( 'baw_count_views_meta_key', '_count-views_' . $time . $date, $time, $date ); This hook is present to give compatibility with any old count plugins that had already record some counts for your blog. Example of use with wp-postviews: Its meta_key is “views” so i do this: function modify_metakey_for_bawpvc( $data, $time ) { return $time == ‘all’ ? ‘views’ : $data; } add_filter( ‘baw_count_views_meta_key’, ‘modify_metakey_for_bawpvc’, 10, 2 ); This return “views” if the selected stats count is “all” ! You can also play with $time and $date to do some checkings. baw_count_views_count: apply_filters( 'baw_count_views_count', $count, $meta_key, $time, $date, $id ); You can modify the $count value here, depending on time, date or meta_key. I added this in case of … You can avoid recording count on different date or cheat on counting x) baw_count_views_count_action: do_action( 'baw_count_views_count', $count, $meta_key, $time, $date, $id ); Same as above, you can run your own code here. widget_title This is a WordPress hook, see codex or core code. baw_count_views_capa_role: apply_filters( 'baw_count_views_capa_role', 'edit_posts' ); You can modify the capatibility or rolle needed to see and modify the posts views stats. Example: function bawpv_count_views_capa_role( $capa ) { return ‘administrator’; // or // return ‘manage_options’; } baw_count_views_render_post_columns: apply_filters( ‘baw_count_views_render_post_columns’, $post_id );` You can add (or remove?) more then only the “all” count stats in post page list in admin panel. Example: function baw_count_views_render_post_columns( $post_id ) { echo ‘‘; echo ‘Month: ‘ . (int)get_post_meta( $post_id, ‘_count-views_month-‘.date(mY), true ); } Will display the month stats below the default “all” count. baw_count_views_widget_post_types: apply_filters( ‘baw_count_views_widget_post_types’, $post_types );` You can hack the post types displayed in widget, whatever the settings.

Ratings

3.9
35 reviews

Rating breakdown

Details Information

Version

3.0.2

First Released

14 Feb, 2012

Total Downloads

259,188

Wordpress Version

3.1 or higher

Tested up to:

4.4.20

Require PHP Version:

-

Tags

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.