• Resolved imbeard

    (@imbeard)


    Hi,
    first of all great plugin! I really like it so far.

    I’m using it on a website where posts are loading with an infinite scroll system, next post is loaded during user scroll, is there a javascript function to reload the plugin on new post load?

    thanks!
    Andrea

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Blaz K.

    (@blazk)

    Hi Andrea,

    at the moment unfortunately not. There is a function load_results (see rate-my-post-public.js line 186) which populates the rating widget but it requires sum of ratings and vote count data. This data is retrieved from the server via ajax on page load (see line 33-43). Which plugin are you using for infinite scroll? I’m curious how it works ??

    Blaz

    Thread Starter imbeard

    (@imbeard)

    Hi Blaz,
    thank you for your answer, I’m using this plugin https://autoloadnextpost.com/

    but I modified it according to my needs, you can see it in action here : https://www.baby-chick.com/woodland-theme-baby-shower/

    I’m including your plugin on a staging site but as you can imagine when I scroll to a new article the rating section is the same as the previous article. The autoload plugin has a callback when a new post is loaded so I guess if there’s a way to re-call your load_results inside that callback

    thanks!
    Andrea

    Thread Starter imbeard

    (@imbeard)

    Oh and actually I tweaked the css of your plugin to have a simply thumb up/thumb down look, so I don’t care about the count, I only use rating 1 and 2

    1: thumb down (give feedback)
    2: thumb up (i liked the article)

    Plugin Support Blaz K.

    (@blazk)

    Hi Andrea,
    I checked the AutoLoad plugin and compatibility with Rate my Post. So, there are several problems.

    1. Rate my Post is designed to allow only one rating widget per post. AutoLoad plugin overrides this and thus prevents Rate my Post from working properly. This could be solved if AutoLoad plugin would allow to call a js function before a new post is loaded (you could remove current widget with jquery) but as I see that’s not the case.

    2. Rate my Post depends on wp_localize_script function from where it gets the post id. So, the output of the wp_localize_script function doesn’t change after new post is “auto loaded”. Therefore, even if we call the function to load results it will be always related to the first post and not to “auto loaded” posts.

    To be honest I don’t see any quick and easy solution to ensure the compatibility with AutoLoad plugin. Nevertheless, I’ve put this on my list but I’m currently working on AMP, top rated posts widget etc. What you could do though, is to create a function that hides rate my post altogether when new post is loaded.

    Blaz

    Thread Starter imbeard

    (@imbeard)

    Hi Blaz,
    thanks a lot for taking a look!

    I’ve found a way around editing your plugin adding classes instead of ids on results div and recalling your saving/checking functions on ALNP callback functions, this function passes the current loaded Post ID so I just had to replace your rmp_frontend.postID with the ID returned from the callback of ALNP.

    Using or adding classes instead of IDs there (like #thank-you-msg) could be useful in these scenarios.

    Everything seems to work right now,I have one last question, is there a way to reset stats?

    thank you!
    Andrea

    Plugin Support Blaz K.

    (@blazk)

    Hi Andrea,

    good to hear that you managed to resolve the issues. Votes and feedback can be reset in meta box in edit post. If you want to reset all stats at once you can check “delete all plugin data on uninstall” in the options and then uninstall the plugin. However, since you modified the plugin make a backup first. This option also removes all settings, customization and feedback.

    Blaz

    Thread Starter imbeard

    (@imbeard)

    Ok thanks a lot!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘js callback?’ is closed to new replies.