Not 100% sure on which side the problem is but I noticed that the Total Cache Plugin “breaks” the body class in the Thematic WP Theme. Once the Plugin is activated all browsers return the last browser name as CSS class in the body tag. Any help on this would be appreciated. Thanks!
Hi Nicolas –
We develop using Thematic quite a lot, so I am interested in seeing if I can help you get to the bottom of this. It may be the specific “flavor” of the caching plugin you are using. We use W3 Total Cache, and I don’t think the same problem results. Learn about this plugin here: http://www.w3-edge.com/wordpress-plugins/w3-total-cache/
But if that is the same plugin you use (there are others with similar names), then take a look at one of our client’s sites where we have it in use: http://bfgl.com
If I look at page source for that site, I see:
<body class="wordpress blogid-1 y2011 m12 d31 h22 home singular slug-home page pageid-159 page-author-webfadds page-comments-closed page-pings-closed page-template page-template-NoTitlepage-php mac firefox ff1">
Is this what you did not like? It is actually a very powerful way to take control of what displays on different pages, templates, and even in different browsers. Since each browser gets a class assignment, you could show a different background to people using different browsers, for example, using CSS.
This is not due to W3 Total Cache… these classes are available even without it.
@sfrangos – thanks for your input! We do use W3 Total Cache for that particular project. I understand the body class isn’t a Plugin issue itself. But what we had as output compared to yours is that instead of just having “mac firefox ff11” show up the body class would have the name of the last used browser in the tag.
I also noticed that this was somewhat “random” and I couldn’t really get to the bottom of the problem myself…also because this is a pro bono project and I donate time to them whenever they need it the most. So I have been off and on for the past few weeks.
I will have to dig back in there sometime soon to look at this again. Because it was mainly for some IE fixes where I wanted to take the easy route, I was able to do some other things to work around it.
Once I get time to look at this, I will post back. Thanks!
I’m using a child theme with Thematic and W3 Total Cache, and I’ve experienced the same issue as Nicolas.
When Page Caching is enabled, W3 Total Cache serves a copy of the page which includes Thematic’s body classes from the instance when the cache file was first created – I see that after the cache has been emptied, then first viewing my test site in IE8 on Windows and subsequently viewing it in Mac OSX Safari, the browser specific body classes are defined as “windows”, “msie” and “ie8”.
I’ve checked out the example site provided by sfrangos (http://bfgl.com), and this issue is not present – are you using Page Caching sfrangos?
I use the Thematic body classes extensively to deliver page-specific styles, not so much for browser tailored css, but where I do , it’s usually quite important.
Hello Colleagues –
To summarize the problem, we are discussing how use of some caching plugins renders a body class reflecting the last browser captured by the cache… not the true last browser, if I am correct. That would indeed make it difficult to perform browser based style delivery.
@andy – We recently had a conflict with a security plugin that over wrote the .htaccess code, so when you looked at bfgl.com, we were not using page caching. I have just now put it back in play so have a look in a bit.
I am thinking now that by the nature of caching we will still have a problem with intermittent (depends on the time setting for the cache) problems with capturing the browser class in the body tag. I believe this is the only class that should be in jeopardy.
hi scott!! this is totally just an issue of “caching” something that is meant to be dynamic. it really isn’t a problem with either w3c or thematic. it is how they are supposed to behave, their behaviors are just at odds with one another.
karin and i did not deprecate the browser-specific body classes, but i kind of think they should be dropped. IE-specific targeting should be handled by conditional comment classes, à la html5 boilerplate and i’m not aware the other browsers really need specific targeting?
Thanks Helga – I’d come to the conclusion that caching and browser-specific body classes are not mutually compatible.
I’ve been using them out of convenience, not because they are the best method for browser-specific styles.
Thanks for your input, and I have to agree that dropping them from Thematic is a good idea, just don’t drop any of the post, template or taxonomy body classes!
- The topic ‘W3 Total Cache and Thematic Theme’ is closed to new replies.