WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Caching User Agent Groups and Themes - will this work? (3 posts)

  1. Ben Huson
    Member
    Posted 2 years ago #

    I am trying to configure User Agent Groups to cache the following setup...

    I have a single complex theme which displays content for both desktop and mobile. While most of the mobile styling is handled by CSS there are a few places where I detect mobile in PHP and customise content accordingly.

    If I enable W3 Total Cache Page Caching, it sometimes caches a mobile version of a page and sometimes a desktop version depending on the device a user is using when the page cache expires and needs to be refreshed.

    So I figured I needed to use User Agent Groups to cache two versions (or potentially 3; desktop, tablet, mobile, if I server different content to an ipad also).

    However, if I enable a User Agent Group and set the theme to the same as my main theme - remember, my main theme serves different content for mobile and desktop - this doesn't seem to work, I still sometimes get a desktop device showing a cached mobile version.

    Also, if I try to enable 2 User Agent Groups with the same theme, it prevents me from doing so.

    Are the User Agent Group caches created with the theme or the group name as an identifier? I would expect them to use the group name so you could potential have 3 different caches of the same theme?

    Thanks

    Ben

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Plugin Author

    Posted 1 year ago #

    That's the right thinking. The caches for each group are prefixed by the group name.

  3. Ben Huson
    Member
    Posted 1 year ago #

    Hi Frederick,

    Regarding my issue above, I have resolved most of my issues.

    The remaining issue is I would like to be able to select the same theme for the 'High' group and the 'Low' group.

    Basically the theme itself has a level of user agent detection and I want to be able to create separate caches of that theme depending on the user agent.

    As the caches for each group are prefixed by the group name that should be possible, but currently if I try to enable 2 groups with the same theme, I get a Javascript alert which says "Duplicate theme 'my-theme-name' found in the group High".

    Is there any reason why W3C prevents me doing that?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic