JerresonJ/Order-By-Engagement

Compatibility with cached sites: PHP vs Ajax

Closed this issue · 1 comments

Order By Engagement is not working on cached sites as of 1.1.0. The plugin requires that certain parts of WordPress be hook-able, which is not the case on many sites due to the way cache/performance plugins work. While this is the case, many sites can operate using the current PHP and WP_Cron-based method.

What we'll do is make the very first selection in the interface a choice of operating by PHP or Ajax. PHP will be selected by default and will continue to operate the way it does now. Meanwhile the Ajax method will add a script to wp_footer using wp_register_script() wp_enqueue_script() all the while checking to make sure jquery is an enqueued script. This jQuery used in Ajax mode will allow sites which are cached to still perform OBE's functions even though no methods are hookable for the plugin. It will make an Ajax call to a PHP function found in the OBE plugin which does the work outside the cached area of the site.

I tested the 1.2.0 updates today. I made a few tweaks just to conform to WP plugin standards a bit, but it seems to work perfectly. Posting to Extend today.