Closed conatus closed 12 years ago
You could try it out and let us know. We don't have any experience using them together yet.
W3 Total Cache is fantastic and has really sped up my site. It does work very well with the Roots theme but not when it comes to minification and browser caching. W3 Total Cache rewrites the urls- for example- http://myblog.com/wp-content/w3tc/min/6a6a912d.dcd8f1.css
This happens after the Roots theme has done its work so I don't think there is much that can be done. However, perhaps we could add the rewrite code to the W3C Total Cache plugin? The problem is I don't know how you'd do that. If anyone knows I would LOVE to know. Perhaps this would be out of the scope of this discussion. Is there a forum for the Roots theme?
I started a discussion on the wordpress Stackexchange website on this (see http://wordpress.stackexchange.com/questions/25418/how-can-i-hide-that-i-use-wordpress-with-w3-total-cache ), it would be great if we could get W3 Total Cache to play ball. Perhaps it is best if we bring this up with them?
Unfortunately W3 Edge (the W3 Total Cache developers) have confirmed that url rewriting is not on the road map. Is there a way we can get the Roots theme and the W3 Total Cache plugin to play ball?
Afaik Wp Super Cache is working ok with Roots - But I didn't try the advanced features.
@baritoneuk : could you by any chance give it a try ?
@johnraz - W3 Total Cache seems to be much more powerful and offers a lot more features than WP Super Cache. For many WP Super Cache will be sufficient, but I love the way W3TC offers Page Speed API, Cloudflare and other types of integration. The minification option is also brilliant and the way it can string together all the css files (and js) to reduce http requests. W3TC is compatible with the Roots Theme as long as you don't use minification. Having thought about it, it's probably better to minify manually and upload to the server and let W3TC do all the other stuff. That way W3TC doesn't undo all the great work that the Roots Theme has done.
btw, as I am a MASSIVE fan of the Roots Theme, I was wondering if we could have a forum to discuss things. This thread isn't really the place to discuss things like this (it's just for issues). Also, it would be great if there was a video to accompany the website. I was wondering whether any of you had heard of the Get Skeleton framework which is fantastic. It would be great if this could be integrated with Roots. Are there any plans on rewriting the login url to Wordpress? Roots does a great job of discuising Wordpress, but the wp-admin.php file still works. Thanks again for a fantastic theme!
@baritoneuk you can hack your way around w3tc. It's (more than) a little ugly, but I think I managed to get it to work.
Step 1 (the good): add a rewrite rule /min -> /wp-content/w3tc/min (that's the easy part) Step 2 (the bad): add this code somewhere (your functions or a custom plugin)
add_filter('w3tc_minify_content', 'remove_w3tc', 10, 1);
function remove_w3tc($buffer) {
return preg_replace('/wp-content\/w3tc\//','', $buffer);
}
Step 3 (the ugly): Monkey patch W3TC plugin in wp-content/plugins/w3-total-cache/lib/W3/Plugin/Minify.php [line 267]
$buffer = apply_filters('w3tc_minify_content', $buffer); // add this before the line
return $buffer;
The ugly part can be avoided if W3TC play nicely with other plugins and add this filter hook to their code. Some other plugins (e.g. wp-minify) do that...
In relation to your stackoverflow query, there are other things that W3TC does, like injecting some comments etc to publish itself, that will expose the fact that you're using it... so if you must completely hide, there are other places to monkey patch.
Thanks for this information, really useful.
Just confirming that it works fine with CloudFlare.
@gingerlime - wow, this looks cool. I haven't tried to implement it yet, but I'll have a go when I get the chance. The only downside is that each time we update the W3TC plugin the hack will have to be re-implemented, but I suppose that's a minor issue- your hack looks really elegant (despite you saying it's ugly!). The Good and bad step wouldn't be affected, but the 3rd (ugly step) would be.
Thanks @baritoneuk
W3TC is a very robust plugin and very versatile, but even the best plugin can't allow hooks/filters everywhere in its code. That said, I think in this instance, adding this particular hook to W3TC is a very reasonable request. Frederick Townes might agree to add it to the W3TC codebase if you ask nicely (?)
However, as I mentioned earlier, even if you do this - W3TC has some other visible parts. One in particular which I personally think should be optional, is the echo of headers + comments into HTML which look like this
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/ ... -->
I can understand the plugin author's wish to advertise its plugin (even in HTML comments). This might be a little more tricky request to change.
Given that this is all open source, it shouldn't be too difficult to create a fork of W3TC and merge any new features (sans any exposing stuff). That is, if someone's got the energy to maintain it and keep catching-up with W3TC core. Not a huge task, but not particularly exciting either...
p.s. I did a quick test with roots + W3TC + Amazon cloudfront and it seems to work well with stuff under /assets without any customization.
This all looks awesome, I'd bet that the W3 Total Cache Team would be open to implement this filter in their code base if you ask them gently and explain why you need it ;-)
That way no more monkey patching -- Everything is nice and clean in Unicorn world (wait it's no django app here :x)
@gingerlime - the way W3TC adds the comment annoys me. I did ask them about making it optional. I asked specifically-
It would also be great if there was an option (perhaps on a "pro" version) to remove the final comment on each page with the reference to W3 Total Cache.
but they replied... "I just confirmed that the requests weren't on the roadmap."
Is there a way to remove this, albeit in a hacky way? Sorry, this is probably going offtopic...
it's dirty but.. in the original release of roots we used output buffering to remove the source comment from AIOSEOP - if you download the first tagged release and check out roots-ob.php then you can update it to do the same thing for W3TC
I don't know how I feel about this, as I don't think it the comment addition is that unreasonable considering how great the plugin is.
However, greping the source for the message provided will easily show you what you need to remove.
On 4 January 2012 22:03, Ben Word < reply@reply.github.com
wrote:
it's dirty but.. in the original release of roots we used output buffering to remove the source comment from AIOSEOP - if you download the first tagged release and check out roots-ob.php then you can update it to do the same thing for W3TC
Reply to this email directly or view it on GitHub: https://github.com/retlehs/roots/issues/112#issuecomment-3361953
Records On Ribs - a record label that releases all its music for free download under a Creative Commons license http://recordsonribs.com
@retlehs - cool, I'll have a look. I used output buffering on my non-WP sites. What was the reason for not using it in subsequent releases?
@conatus - I know where you are coming from. It's just one of the cool things about Roots (and there are many cool things) is that it removes all the WP related clutter from the source. I like my source code clean and light, and it's a big shame that W3TC (as amazing as it is) stamps a big mark at the bottom of the source.
@baritoneuk i removed it because i didn't like the idea of having the output buffer simply for that reason. i hate those unnecessary comments too (and now use WordPress SEO from yoast which also does it), but i've just ignored it lately
it's kinda silly that plugin devs won't at least offer a 'pro' version that will strip all credit including in the source
Totally agree with @retlehs, and find it silly too. Perhaps creating an 'W3TC obfuscated' fork is not such a bad idea if several people need this feature. Then you fix the code once in very few places, and everybody can enjoy and re-use it. Of course you're then having to play catch-up with W3TC core... but with git diff it's not such a difficult (albeit boring) task.
Could someone give me a hint on what the best practice for the paths / URLs could be when using a CDN? I use WP Super Cache and everything is still linked relative. I'd like to keep it that way for posts and pages etc., since it's very smart, but need assets, theme-images, css and js to be linked absolute like cdn.domain.com/css/style.css
instead of /css/style.css
.
The no-brainer-way would probably be to change the rewrite-rule striaght to the cdn but that isn't desireable since the different sub-domain would make parallel loading of the ressources possible. What would you do?
@madeyourday I don't know about super cache, but with w3tc I didn't have to do anything, and it automatically converted all /assets/* links to point to the cdn. Maybe all I did was tick 'Host attachments' box. I'm not sure. But nothing more than that. (I'm using w3tc with amazon cloudfront origin-pull cdn though. Other configurations might be different of course)
@gingerlime thanks, so at least W3TC would be a working alternative. Nevertheless, maybe someone knows a solution for WP Super Cache too, since it's so lightweight and for that reason a good complement to roots.
sounds like we need to move some of the info from this issue into the wiki
anyone want to take care of that? :)
I'm currently building a large scale website that will use massive caching. I'll probably need to read this along so I'll try to summarize what's important ;-) (expect 2-3 weeks delay)
closing as there are no issues - will add some info from this thread into the wiki with #264
Hey folks,
Great theme, but what I am wondering is that, considering the extensive re-writing it does with the locations of assets, javascript and so on, does the W3C Total Cache plugin still function as expected? Particularly if you have the CDN elements activated.
Thanks in advance,
Alex