Support for AJAX loading

Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

If your theme is using AJAX to load pages, or if you have a plugin or some other code that loads content through AJAX, and if that content contains rating elements, your rating blocks will not be initialized, because the content is loaded after the page is loaded and after the rating plugin has already run. There were some workarounds for this problem before, but now, plugin version 3.7.4 and newer include the prope method of running initialization after you load your content through AJAX.

The initialization is run in JavaScript, and it can be run more than once, on each AJAX loading or whatever else your code might do. The one function call you need to make is:

wp.gdrts.core.ajax();

This call can be made only if the page initialization is fully completed so that all plugin libraries are initially loaded correctly.

0
0
483
Rate this article

You are not allowed to rate this post.

Leave a Comment