Hi, how to prevent the issue that every page refresh the counter adds +1.
Thanks!
E_ERROR: Call to undefined function add_action()
…/wp-content/plugins/wp-postviews/wp-postviews.php (33)
]]>I just noticed one of my post had 12000 views but when I checked my jetpack stats, i actually had 15000. How to fix please?
]]>Hi!
First: great plugin, very simple but usefull.
I wrote a little additional function to this plugin. I’ve noticed that if i want to show posts views on main page (or anywhere except single.php) that incerase view property even if no one see the article. So I’ve decided to add function echo_post_views_not_counted() with is not adding view info to db. Now on every page I use this function, and on page single.php im using normal echo_post_views(). Maybe for someone it will be usefull.
Paste the following function in wp-post-view.php file, below echo_post_views() function (in my case 19.03.2013 – ver 1.0) its 125 line).
if (!function_exists('echo_post_views_not_counted')) {
/**
* Echo, print or display the views of the post.
* @param <type> $post_id
*/
function echo_post_views_not_counted($post_id) {
if ($post_id) {
$views = wp_get_post_views($post_id);
echo number_format_i18n($views);
} else {
echo 0;
}
}
}
Use simply like other functions:
<?php echo_post_views_not_counted($post->ID); ?>
or
<?php echo_post_views_not_counted(get_the_ID()); ?>
Whenever I activate the plugin, I get these errors:
Notice: Undefined offset: 0 in /home/content/20/9023620/html/wp-includes/plugin.php on line 767
Notice: Undefined offset: 0 in /home/content/20/9023620/html/wp-includes/plugin.php on line 785
Anyone getting this or know how to fix it? I’m not sure how because it has to do with the core files…
]]>hey, the plug-in is working perfectly but i have one question,
is any possible to show on main page under every new entry get how many was views?
but when i will put that code:
<?php echo_post_views(get_the_ID()); ?>
into index.php it will count new refresh views. but i just want to show how many views was when my post was open. (from single.php)
can u help me?
]]>Love this plugin, it’s the only one I’ve found that lets me display the number of views right in the post. However I noticed that every time I refresh a certain post, it counts it as a new view, meaning you could in a sense “cheat” by refreshing multiple times and running up the view count on your post.
I’m not an experienced coder, so I was wondering if it was possible to add a function or modification that would cause the plugin to count post-views based on ip address or something similar to that. And if so, I would really appreciate if you could post the solution and the code that must be used as well as where to insert it (luckily, I know enough to be able to do that by myself lol).
Thanks in advance!
]]>This plugin is not working for me, i place echo_post_views(get_the_ID()); in my single.php but just display the code.
]]>Anyone else have same problem?
The plugin seems to work good, but as soon I deactivate it, it causes such a error that (if not in use, temporary or permanent) I have to delete the code out of single/page.php file(s).
Is error related to the wordpress version maybe?
]]>