In response to JTPratt’s comment on my post, “Make Popularity Contest Work with WP-Super-Cache,” I am releasing a modification of Lester Chan’s WP-PostViews plugin to support counting using Javascript. Please try it out to see if this works for you.
A side note to Lester Chan and Richer Yang (WP-PostViews and WP-PostViews Plus authors repectively). Please feel free to contact me about incorporating these changes into WP-PostViews and/or WP-PostViews Plus so that it can be officially committed to the wp-plugins.org repository. I would create my own version of WP-PostViews in the repository, but do not want to steal your thunder :).
Download:
WP-PostViews JS Mod for WordPress 2.5
Note:
Modded Plugin only tested to work with WordPress 2.5 and is probably not backwards compatible with WordPress 2.3.3 or earlier versions.
Special Installation Instructions:
Intallation works the same way as the original WP-PostViews except that you will need to do ONE OF THE FOLLOWING:
- Place a symbolic link from wp-content/wp-postviews-js.php -> plugins/wp-postviews/wp-postviews-js.php
- Move wp-postviews-js.php directly under your wp-content/ directory
That should be all. I would really appreciate it if you can provide any feedback (security issues, better implementations, or other important thing that I’m totally not aware of). Also please feel free to email me with questions and keep me posted on how things are going with the plugin.
| 3.5 |
Thaya Kareeson 

April 30th, 2008 at 2:00 pm
Thanks a lot.
April 30th, 2008 at 2:36 pm
You’re welcome! Please feel free to send me any questions or comments about this modification. And if you really like it, please write about it :-).
April 30th, 2008 at 4:16 pm
I stil don’t understand abut “Place a symbolic link”. What is symbolic means?
Maybe I’ll repost this plugin on May 3.
April 30th, 2008 at 8:42 pm
You can find information about what symbolic links are at Wikipedia. Symbolic links are only available on a Unix/Linux environment. If you are hosting from a Windows machine, you can just move wp-postviews-js.php directly under your wp-content/ directory to achieve the same effect. Hope this helps.
May 2nd, 2008 at 8:00 pm
I thank you for this fix - it worked GREAT on one of my sites! It didn’t (and may never) on my main site though, since I use 4 dozen odd plugins. I wonder, sezwho was one problem I had, as well as wp-postratings by lester chan.
What happens with the WP-Stats plugin (wordpress.com official stats) when wp-super-cache is enabled? Are views of cached pages counted in your stats, or not?
May 3rd, 2008 at 5:35 am
It works. And it works GREAT!
Moving wp-postviews-js.php into wp-content was enough, no need to mess with symbolic links, for who doesn’t know how to do this
May 3rd, 2008 at 9:51 am
What is your main site? I’m not sure why it’s not working on your main site, but I believe the reason could be that the Javascript in this mod clashes with one of your other plugins’ Javascript. The mod I did here is supposed to work with any other cache plugin, but WP-Super-Cache is supposed to have a hook called “add_cacheaction” that can be used to add a count action. I’ll look into it to see if this method would work (and probably write a post about it if it does).
@justfrank
Thank you for visiting! I’m glad that the mod worked out for you.
May 3rd, 2008 at 9:54 am
I forgot to answer the second part of your question. I’m pretty sure the WP-Stats plugin will not record hits if WP-Super-Cache is enabled. That said, I think it can also benefit from the method of using WP-Super-Cache’s add_cacheaction hook. I’ll explore this further and keep you posted on my findings.
May 3rd, 2008 at 12:27 pm
My main site is http://www.jtpratt. Now, after 24 hours - my other site I thought everything was working on isn’t registering and counts on postviews at all. On the other hand, WP-Stats seems to be working fine ( so far )…
May 4th, 2008 at 11:06 am
Interesting, I will have to look into WP-Stats to see how it works. Thank you.
May 6th, 2008 at 12:47 pm
I can’t seem to make it work. Postviews doesn’t count even when Super Cache is off. Do you have a list of compatible plugins or at least those that have conflicts with this?
May 6th, 2008 at 12:51 pm
Sorry I do not have a list of compatible/conflicting plugins. Please stay tuned, I will be releasing a non-javascript version soon (within the next day or two). Sorry for the delay!
May 6th, 2008 at 12:53 pm
Err no wait.. Scratch that. I forgot about the symbolic link. Umm… does shared hosting even support that? Can I use .htaccess?
May 6th, 2008 at 12:55 pm
It depends on your shared host. I recommend just moving wp-postviews-js.php directly under your wp-content/ directory if your hosting does not support symbolic links.
May 6th, 2008 at 5:36 pm
Thanks. I got it working now. I think I screwed up the first time because I had a copy of wp-postviews-js.php on both the wp-content directory and the wp-postviews directory
Thanks again.
May 7th, 2008 at 8:38 pm
Thanks a lot. Just advice to the others, if you activate this plugin, its better to you to delete the cache of wp-super-cache, after activating this plugin.
May 7th, 2008 at 8:55 pm
I’m glad it works out for you.
@hendra
I’m glad it works out for you too, and thank you for your advice.
May 8th, 2008 at 3:24 am
@ Thaya : Than, it still work on wp super cache?
May 8th, 2008 at 9:21 am
Yes, I will make use of WP-Super-Cache’s add_cacheaction hook to get WP-PostViews to count without Javascript while WP-Super-Cache is enabled. After evaluating the code, there is more work involved than I first thought, but it should be more efficient than the Javascript version when finished.
May 11th, 2008 at 9:04 pm
Unfortunately, it turns out that I misunderstood the add_cacheaction hook. Previously, I thought that add_cacheaction hook gets called every time before a cached page is delivered. I was wrong and there currently is no such hook available in WP-Super-Cache right now. I will definitely make a request to Donncha to add this to WP-Super-Cache. So as it stands, you are stuck with the JS Mod version of WP-PostViews.
I have to appologize for getting your hopes up. The WP-Super-Cache code is quite complex (if Donncha doesn’t walk you through it :)), so it took me a while to figure this out.