WordPress.org

Ready to get started?Download WordPress

Forums

Awebsome! Browser Selector
[resolved] issues when combined with wp super cache (7 posts)

  1. James Revillini
    Member
    Posted 2 years ago #

    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.

    http://wordpress.org/extend/plugins/awebsome-browser-selector/

  2. James Revillini
    Member
    Posted 2 years ago #

    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

  3. Copernicus
    Member
    Posted 2 years ago #

    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?

  4. James Revillini
    Member
    Posted 2 years ago #

    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.

  5. Copernicus
    Member
    Posted 2 years ago #

    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!

  6. Raul Illana
    Member
    Plugin Author

    Posted 2 years ago #

    Yo jrevillini!

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

    There's a new interface coming also, FYIO. :)

    Best!
    R

  7. James Revillini
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic