WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
[resolved] Using supercache with a theme switching cookie (4 posts)

  1. jonathanstegall
    Member
    Posted 3 years ago #

    Hello,

    I have a site (running 3.1) that needs to display a different header and footer (for a partner who promotes the site) if a specific querystring is present. For simplicity, http://domain.com/?cobrand=partner is how this works. I am just getting familiar with how the system works, as I didn't create it and I'm trying to discover what it's issues are.

    The main theme, then, does the following things:

    1. Check for a cookie, or a $_GET value.
    2. If either matches, set the cookie (if it is unset), add the needed HTML, and run an add_filter (change_template) to switch the theme itself to one that contains the right HTML.

    This works well, though I'm not sure how efficient it is. The problem is that I don't think Super Cache ever caches pages that have the querystring. It does run on those pages, as I see the following in the footer everytime:

    <!-- Dynamic page generated in 0.413 seconds. -->
    <!-- Cached page generated by WP-Super-Cache on 2011-03-16 09:28:56 -->

    So I think it just doesn't cache anything. Anyone have insights into this? Alternatively, a better method for switching themes and storing the result based simply on a querystring?

  2. jonathanstegall
    Member
    Posted 3 years ago #

    Bump? Still lost on this one.

  3. Donncha O Caoimh
    Member
    Plugin Author

    Posted 3 years ago #

    The first page with the GET query won't be cached, but you can modify the COOKIE checks in wp-cache-phase1.php to look out for your partner cookie. You can use a cacheaction instead of modifying source code. (see the developer docs linked from the readme) Pages will however be cached using legacy caching mode in the current version.

    The next version will have code to create new supercache directories but it's incomplete right now.

  4. jonathanstegall
    Member
    Posted 3 years ago #

    In case others should have this issue, for the time being (though I'll look forward to the next version of course) I've decided to use the DB Cache Reloaded plugin (with a fix for WP 3.1). It just caches database queries, so the page gets rendered in whatever theme is appropriate for the user, whether based on querystring, cookie, or some other method.

    Now, of course this is a really random situation that I've never had on any other sites, so I can certainly understand that it's not the highest of priorities :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic