• Resolved James Revillini

    (@jrevillini)


    When using the WP Super Cache plugin, the classes on the rendered page will be generated when the cached version of the page are generated, and therefore will be inaccurate for others. I know this is not a bug in your plugin, but thought you would like to know in case you wanted to make it compatible. Depending on the performance hit, I may make an additional call to the server for the classes to add to the body using AJAX and then include them to the page post-render. If i base it on your code, i will send you the code to consider.

    https://www.ads-software.com/extend/plugins/awebsome-browser-selector/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter James Revillini

    (@jrevillini)

    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');: https://pastebin.com/yBX2chMs
    This JS goes in awebsome-browser-selector/js/fetch-body-classes.js: https://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?

    Thread Starter James Revillini

    (@jrevillini)

    I think it will. Please let me know.

    Also, use this as the replacement for add_filter('body_class','awebsome_browsel_class_names');
    https://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!

    Plugin Author Raul Illana

    (@raulillana)

    Yo jrevillini!

    Kudos for the fix. I’ll add it in the next release.

    There’s a new interface coming also, FYIO. ??

    Best!
    R

    Thread Starter James Revillini

    (@jrevillini)

    My pleasure and thanks much for rolling it into your little masterpiece here!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Awebsome! Browser Selector] issues when combined with wp super cache’ is closed to new replies.