Just wanted to show number of times a blog post has been read (irrespective of logged, not logged, admin, bot etc)
I tried so many plugins but none seems to work with WP 3 (fresh installation as Multisite directory in a subdirectory).
Either the counter does not increment or it shows nothing or shows error message.
Does any one know of any simple working plugin that simply shows number of hits per post below each post's body and/or teaser and works out of the box with WordPress 3 ?
Does WP 3 has this option in iteself hidden somewhere?
chinmoyda, in WP 3 ota kaaj korchhena
ok stay online. I will search on google. There have some plugin about this . I saw it many blogs. try blog stats plugin now. when i found the plugin i will provide you.
Thanks
C
Hey Kaberi,
this plugin http://lesterchan.net/wordpress/readme/wp-postviews.html is working in my WP 3.0 blog. I checked it locally and it worked perfectly. In loop.php file you would be put this the_views() function.
One most information is that you will put above function according to your blog's design.
Thanks again
Chinmoyda
superpotion
Member
Posted 1 year ago #
Putting the_views() in loop.php will show the post view count, but will not increment it. If you want to increment it within the loop, you must do this explicitly, for example:
<?php
if(function_exists('the_views')) :
$custom_fields = get_post_custom();
$post_views = intval($custom_fields['views'][0]);
if (!update_post_meta($id, 'views', ($post_views+1))) :
add_post_meta($id, 'views', 1, true);
endif ;
the_views();
endif; ?>
superpotion
Member
Posted 1 year ago #
(My code above works, this one is untested) I just spotted the function in wp-postviews.php, which makes this a little more elegant:
<?php if(function_exists('the_views')) :
increment_views();
the_views();
endif; ?>