I finished the mods which make this thing able to add the body classes after the page loads using AJAX, so caching won’t mess with the body classes.
In my case, I’m using WP Super Cache, so the way I coded the mod works for me. It queries whether WP Super Cache plugin is active – if not, it does things the old way. If so, it adds the AJAX script to do everything post-render. I think to make this better suited for any scenario, instead of detecting caching, there should probably be an admin screen for the plugin which lets the user switch between normal mode and AJAX-mode. If I have time, I’ll work on it, but for now, I just wanted to send you the code. Let me know how to proceed.
This bit replaces add_filter('body_class','awebsome_browsel_class_names');: http://pastebin.com/yBX2chMs
This JS goes in awebsome-browser-selector/js/fetch-body-classes.js: http://pastebin.com/v36Bi07p
This also seems to be an issue when Awebsome! Browser Selector is combined with W3 Total Cache.
Do you happen to know if the solution above will work with W3 Total Cache?
I think it will. Please let me know.
Also, use this as the replacement for add_filter('body_class','awebsome_browsel_class_names');
http://pastebin.com/nT4GxLZ5
The previous code had an issue if the WordPress URI was not the same as the site URL.
Thank you jrevillini!
Your solution seems to work very well.
I just changed the line in your pastebin code from:
$plugin = 'wp-super-cache/wp-cache.php';
to
$plugin = 'w3-total-cache/w3-total-cache.php';
then followed your other instructions and everything seems to be working great WITH W3 Total Cache’s page caching now running!
Cheers!
Yo jrevillini!
Kudos for the fix. I’ll add it in the next release.
There’s a new interface coming also, FYIO. 🙂
Best!
R
My pleasure and thanks much for rolling it into your little masterpiece here!