WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
[resolved] Again: Incompatibility with Post-Views and Post-Rarings (15 posts)

  1. iceq
    Member
    Posted 3 years ago #

    Hey. I thank Frederick for the nice plugin.. although it took me two weeks to configure and finally get working (not completely, though).

    But one major disadvantage of W3 Total Cache (and maybe all caching plugins) is that they do not go well with the very famoues plugins by LesterChan: Postviews and Postratings. There is almost no wordpress user who did not use any of these once.

    So, views count and ratings are not updated AT ALL for me, since I installed W3 Total Cache. Only once, while I was configuring W3 and testing the changes, I noticed that the views count changed nad updated immediately when I visited a post. Yet I did not know what is it that I changed in W3 configuration that caused the Postviews to work.

    I wish there is a solution.. I cant give up postviews and postratings on my blogs !

  2. Leo Plaw
    Member
    Posted 3 years ago #

    I've also posted elsewhere searching for a solution to this.

    Post Ratings works for me. Thankfully. 8)

    However, Post Views, does not. I found a plugin that does an Ajax call to update and get the count.

    Ajax_the_views
    http://www.scratch.com/wordpress-plugin-ajax-the-views/

    I'm running a network (multi user) site. On the main site, it breaks, but there could be another plugin that is causing it to fail.

    However on the second sub site, the plugin does the job.

  3. iceq
    Member
    Posted 3 years ago #

    So U R saying that the extra plugin worked for you on postviews on the main site but not the subsites?

    what about post ratings? how did you get it to work?

  4. Leo Plaw
    Member
    Posted 3 years ago #

    No, I think I have identified the problem being that W3TC minify does something that the scripts don't like, only on the "Single" template pages. Some sort of JavaScript file conflict. I'm still sorting through this to find out which one is the culprit, and attempting to re-order the JS files.

    Otherwise with the "Ajax_the_views" plugin works on other pages. Both Post Ratings and Post Views work. Post Ratings, just seemed to work without changes anyway, as it preforms an Ajax call to update the rating.

    I have now removed all JavaScript files from minify for the template "Single".

    I'm now going back and adding the JavaScript files one by one to determine which work under minify.

  5. iceq
    Member
    Posted 3 years ago #

    That means, Minify is not working for you on the Single post page under all circumstances?

    I have neither of the plugins working. If I add rating on the index page, it is updated but as soon as I refresh the index or enter the post I rated from the index, the rating is cleared. The same happens if I add rating from inside the post.

    As with postviews, I installed the Ajax the views plugin, but it keeps displaying "Please wait" instead of the view count . I contacted the author, he said he too is having a similar issue, and that he is testing it.

    But why is it working in the index for you? Btw, the postviews adds a new count when you click on the post link, which is actually transferring you to the single page. So how are you saying that it works in the index but not in the single?

    I wish you share with me any advancement you achieve.

  6. Leo Plaw
    Member
    Posted 3 years ago #

    I do have it working for Single now. Here is an example:

    http://fantasticvisions.net/blog/2010/11/18/phantastisches-kabinett/

    Page View and Page Rating are at the end of the article.

    http://fantasticvisions.net/news/ also lists Page View and Rating, but of course will not increment the view count because it is the main blog page.

    The issue was with JQuery being minified on the "Single" template only. Why, I don't know. I removed it and some others, but not all from the minify list. That is why W3 Total Cache gives you the option to add and remove individual JavaScript files from individual templates and themes. This makes it very flexible and powerful. The plugin author did so because he also found that sometimes minifying all JavaScript files does not work.

    You can also reorder the JavaSript files in the list with drag and drop, say if one script is dependent upon another having defined a variable first for it to work.

    You will have to experiment with which files to minify, and then minify options. As the plugin Author stresses repeatedly everywhere, each site is individual, and there is no one configuration for all. Therefore he gives you so many options to tweak it. This is why this plugin is so much more advanced than the other cache plugins.

    But, here are my minify settings as a guide. You will have experiment and perhaps make yours different.

    Minify Settings

    • General
      • Rewrite URL structure - yes
      • Automatically upload modified files - yes
      • Minify error notification - Admin Notification
    • HTML
      • Enable - yes
      • Don't minify feeds - yes
      • Inline CSS minification - yes
      • Inline JS minification - yes
      • Line break removal - no
    • JavaScript
      • Enable - yes
      • Combine only after - no
      • Combine only after - no
      • Combine only before - no
      • Comment removal - yes
      • Line break removal - no

    Then to select the JavaScript and CSS you want to minify, look a the top of the page for the "help" button on the same line as "empty cache".

    Standard advice seems to be, not to minify scripts like Google Analytics.

  7. iceq
    Member
    Posted 3 years ago #

    Thanx for the help. But I have justed tested both views and added ratings to two different posts on your blog, and it is not updating ! are you sure it is working?

  8. Leo Plaw
    Member
    Posted 3 years ago #

    Just looked at it again. It seems to be flaky. Sometimes it does update, and others not. I think the Ajax_the_views plugin author might need to do some more work on it. Don't know if I have the time to dig into it myself at the moment. It's not beyond me.

  9. Leo Plaw
    Member
    Posted 3 years ago #

    I've just been looking on Lester Chan's WP Post Views support forum

    http://forums.lesterchan.net/index.php?topic=1885.0

    and found this link to a fix.

    http://omninoggin.com/2008/04/19/make-wp-postviews-work-with-wp-super-cache/

    It appears Lester approves of this modification to his plugin. Which means you don't need an extra plugin, like the solution above that I provided.

    However, please note as Lester points out, the page views will update, but you will not see the count change on the public pages until the cache expires.

    BTW, you didn't go through and put those bogus ratings on my articles did you?

  10. Lester Chan
    Member
    Posted 3 years ago #

    Yeap as long as WP_CACHE is set to true in wp-config.php, WP-PostViews will update the count using AJAX upon loading the page but if the cache of the page does not expire, the count will still be the older one.

  11. Stephen Cronin
    Member
    Posted 3 years ago #

    Hi All,

    Yeap as long as WP_CACHE is set to true in wp-config.php, WP-PostViews will update the count using AJAX upon loading the page but if the cache of the page does not expire, the count will still be the older one.

    Ajax_the_views was written to specifically address this issue (bold mine). It only "ajaxifies" the display of the count.

    It doesn't do anything to increment the count, because as Lester points out, WP_Postviews already does this. Note however, there is one trick in the setup of the W3 Total Cache:

    If database caching is turned on, then although WP-Postviews receives the Ajax request, the call to update the DB only works once every 180 seconds (or whatever interval you have set for database caching). To get around this, you need add an ignored query stem of wp_postmeta, as WP-PostViews stores the views as a Custom Field for each post.

    Ajax_the_views should work on any page where the number of posts is displayed. This includes both individual posts and the home page.

    However, as Leoplaw mentions, there is a known problem at the moment. I 'm planning to look into this shortly, but am pretty busy and have had to prioritise both the day job and paid client work over this issue. I'll try to bump it up the priority list and post back here when it's fixed.

    I'll have a look into the problem with minifying the script as mentioned above (this is the first I've heard of it).

    Cheers,
    Stephen

  12. Leo Plaw
    Member
    Posted 3 years ago #

    @Stephen Cronin can you explain your statement in more detail please?

    "To get around this, you need add an ignored query stem of wp_postmeta, as WP-PostViews stores the views as a Custom Field for each post."

  13. Stephen Cronin
    Member
    Posted 3 years ago #

    @Leo Plaw

    That's nothing to do with Ajax_the_views, it's just a step you need to follow to get WP_Postviews to count properly.

    This is on top of the solution that Lester built into WP_Postviews and is talking about above. What he is talking about will work with most caching plugins and with W3 Total Cache with database caching turned off.

    However, if W3 Total Cache has database caching turned on, it will only update the database once every 180 seconds (or whatever this is set to in W3 Total Cache). I found that during this time, it won’t record page views, presumably because W3 Total Cache is catching database calls and serving up whatever was returned last time (but not actually updating the database).

    This can be solved by either turning W3 Total Cache's database caching off OR by telling W3 Total Cache to ignore the table that the post view count is stored in (wp_postmeta). To tell W3 Total Cache to ignore wp_postmeta, you need to add an ignored query stem of wp_postmeta. From memory, this is done on the Database Caching page of W3 Total Cache, but I don't have the screen in front of me.

    Hope that helps...

  14. Iva
    Member
    Posted 3 years ago #

    In my case, this doesn't change anything. It only says "Please wait" instead of showing anything for views. It doesn't even show 0 views anymore.

  15. Leo Plaw
    Member
    Posted 3 years ago #

    @Stephen Cronin thank you very much for the "wp_postmeta" tip. It works!!!

    I now have caching, post counts and ratings all finally working together. 8)

    Wow! The W3 Total Cache author Frederick Townes (?) really thought of everything. A big thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic