• Resolved evo252

    (@evo252)


    Hello,

    Thanks for this great tool ! I would like to know how to ajaxize WP Post Views plugin in order to make it work with W3 Total Cache and Varnish Cache. In fact, WP Post Views doesn’t increment well counters of posts because of caching solutions we have on our blog.

    I tried to ajaxize ‘the_views’ function, but the counter displays “0 views” rather than the real amout of views.

    Thanks in advance ??

    https://www.ads-software.com/extend/plugins/ajaxize/

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author yoav.aner

    (@yoavaner)

    Hi evo252,

    I’m not entirely sure to be honest. Had a quick-check and got the same behaviour as you. I’m not familiar with this particular plugin, but it might check the views based on information in the page/post itself, and therefore, when accessed via the ajax call, it doesn’t get the contextual information it needs…

    Don’t think there’s much I can do about that, but best thing is to contact the plugin author.

    I did however notice on the plugin info that it claims to work with caching solutions.

    Yoav

    Thread Starter evo252

    (@evo252)

    Hello Yoav,

    Thank you very much for your help. Unfortunately, the author of WP Post Views is not able to provide support since 1 year, so I don’t find any solutions for this specific problem, and no alternative for counting views on articles.

    WP Post Views runs fine with WP Super Cache but unfortunately not with W3 Total Cache (and less for server caching solutions like varnish): I noticed a big decrease of number of readings since cache has been installed on my server, so the only solution would be an ajax counting views.

    Plugin Author yoav.aner

    (@yoavaner)

    Thread Starter evo252

    (@evo252)

    Yep, but it shows “Please wait” indefinitly ??

    Plugin Author yoav.aner

    (@yoavaner)

    This is probably not the right forum, since I’m trying to solve a bug in another plugin, but I’ve had a quick look and if you want a real quick-n-dirty fix for ajax-the-views (not for my plugin though), then try adding this javascript to your footer.php (right after wp_footer)

    like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Plugin Author yoav.aner

    (@yoavaner)

    Thread Starter evo252

    (@evo252)

    Hey Yoav,

    Hope you’re fine, and thousand and thousand thanks for your help.

    I didn’t understand exactly what is the changes provoqued by the code you sent me, is it not the same that ajax_the_views launches at the footer page ? Anyway, I implemented it into my code and it didn’t change anything: “Please wait” continues to show rather than the views.

    Let me know !

    Thanks again

    Plugin Author yoav.aner

    (@yoavaner)

    there’s a slight change to the code that generates the javascript (particularly the url where the javascript gets its data from). Testing it quickly on my wordpress, I did get back ‘2 views’ instead of ‘Please wait’ after I placed it in the theme’s footer.php

    As I said it’s a very ‘quick-n-dirty’ fix, so perhaps not what you should be searching for. I suggest posting on other forums or searching for different post-views plugins if you can’t get this to work.

    Thread Starter evo252

    (@evo252)

    Hello Yoav ! It works like a charm ! Awesome, the plugin counts now the views in real time ?? I don’t know if you can, but I think you should update the plugin Ajax_the_views on the wordpress plugins library.

    Strange fact: your hack didn’t run well immediately on my blog (but worked on another test blog), but after putting your code on the header and not footer, it has worked. Note that I deleted the precedent code on the ajax_the_views PHP file, hope i made things correctly.

    Thnk you so much !!!!!

    Plugin Author yoav.aner

    (@yoavaner)

    Glad it helped evo252. It’s not that simple to update somebody else’s plugin code. Usually you’d have to ask them for permission, and some times make another plugin copy… Not exactly what I had in mind when I created Ajaxize. I’m not even sure my fix is the right one. As I said, it was very quick and perhaps not the most elegant way to solve this problem.

    The best thing you can do is post a message on the ajax_the_views forum and ask about it. You can probably also point to this thread / code in pastebin. I know I can do it too, but since I’m not actually using this plugin, I feel it might be inappropriate in this case.

    Thread Starter evo252

    (@evo252)

    Hello,

    Ok, I understand, it’s as u like. I think however that the fix is correct, because the tool is working very well ??

    Thank u so much…

    Plugin Author yoav.aner

    (@yoavaner)

    No problem. If you want to help others, I really suggest you post something on the ajax_the_views plugin forum. It’s up to you of course.

    Thread Starter evo252

    (@evo252)

    Hello Yoav,

    I wanted to say you thanks again, because I’m so indebted to you for the time you gave me to fix the bug of this plugin !

    I’ve posted a message to inform those who could have the same problem as me on the plugin forum !

    Thank u so much…!

    Plugin Author yoav.aner

    (@yoavaner)

    Hi Evo252,

    Thanks for doing it.

    BTW, Ajaxize 1.1 now supports context information, and should in theory also work with functions like the_views.

    I guess you already have a working solution for WP Post Views, but you might want to do it through ajaxize. If it works it might be slightly more elegant, and no need to tweak footer/header php files.

    Yoav

    I’m not really sure what ajaxize is suppose to do.

    Is it about making the site more w3c standard compliant by making other plugin authors coding hook to output only 1 code that is required rather than many duplicates ?

    Sorry, bit of a nub here :X

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Ajaxize for WP Post Views ?’ is closed to new replies.