-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't work with multisite #52
Comments
Have you tried https://github.com/sanchothefat/wp-less instead? It's the better plugin right now. |
There is an element of answer in #36. Is the proposed solution somewhere in the comments helpful enough to solve the problem? I thought it has been added in the plugin's code but apparently I missed it. |
Sorry I wrote the answer meanwhile you were editing. I thought this was fixed. In any case, hardcoding to |
But will this be fixed in a feature version? |
If you could provide those 3 values, we could figure out how to address the problem nicely:
Thanks 👍 |
The problem is that |
@royduin yeah I know but that does not help me to fix the problem :-) |
Today I gave LESS-WP a try - but it doesn´t compile any less-files on my multisite installation, so what can we do to support for a fast solution of the problem? |
As stated above, I need to understand what is multisite configuration generating. So if you could provide those 3 values, we could figure out how to address the problem nicely:
|
did anyone develop a solution to this so far? |
What does |
Thanks @royduin - your fix is a lifesaver!! |
@wtaeke is there any chance you can tell me what is the value of Thanks! |
Hi @oncletom,
Hope this helps. I have my Network Site B mapped to example-b.com using WordPress MU Domain Mapping. |
@oncletom |
Please don't be rude, as this is not going to help. |
Sorry, I didn't want to be rude! Blame my bad english skills ;) |
In any case, for what I can see:
A more flexible system is required. Like replacing the path from the value of To be honest I don't have PHP nor wordpress installed on my machine anymore – you'll have to help me figuring out a solution. Try out if the following works. $wp_content_dir = str_replace(ABSPATH, '', WP_CONTENT_DIR);
$this->source_path = WP_CONTENT_DIR.str_replace($wp_content_dir,'',parse_url($this->stylesheet->src, PHP_URL_PATH)); Note: it is wrong to hardcode |
@oncletom I've got domain mapping on a multisite with external domains coming in, and I experienced the issue that this thread started with, and this code seems to have fixed the issue when replacing line 87 in Stylesheet.class.php with it. Probably not the most concrete fix, but it's a good patch for now
|
@oncletom Your proposed patch works fine. I'm running the "other" flavor of multisite (folder) and this solved the problem for me. |
@schnoggo yes please, go ahead :-) |
@schnoggo from the top of my head, this is what I tried but it had different behaviours between MU websites and non-MU ones. Or they did not provide exactly the same value. I'm up for any solutions which works for MU and non-MU websites, with standard and custom WP_CONTENT_DIR values. |
Here's a (sanitized) dump of what's going on: $this->stylesheet->src: http:somesite.com/{sub-site}/wp-content/themes/{mainsite}/style.less So the catch is that enque is using a URI, but you need a local path to set/check the mod time of the file. Can anyone think of a case where that would cause a problem? |
All of these solutions assume the path is in the theme folder... (Or at least the wp-content directory...) |
Here's my proposed patch: // path to local content dir does not match URI in multisite.
$wp_content_dir = str_replace(ABSPATH, '', WP_CONTENT_DIR); // get the 'wp-content' part of the path
$lessfile_in_theme = preg_replace ('#^.*?' . DIRECTORY_SEPARATOR . $wp_content_dir . DIRECTORY_SEPARATOR . '(.*)$#', '$1', $this->stylesheet->src, 1); // the part after 'wp-content'
$this->source_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $lessfile_in_theme;
// $this->source_path = WP_CONTENT_DIR.preg_replace('#^'.content_url().'#U', '', $this->stylesheet->src); I tested this in a regular WordPress install, multisite (path-based) root site and multisite child site. @TrevorMW any chance you could try this patch your domain-based system? |
@tyrann0us Could you see if this solves your issue? (If it does, I'll post a pull request right away.) protected function configurePath()
{
$target_file = $this->computeTargetPath();
// path to local content dir does not match URI in multisite.
$wp_content_dir = str_replace(ABSPATH, '', WP_CONTENT_DIR); // get the 'wp-content' part of the path
$lessfile_in_theme = preg_replace ('#^.*?' . DIRECTORY_SEPARATOR . $wp_content_dir . DIRECTORY_SEPARATOR . '(.*)$#', '$1', $this->stylesheet->src, 1); // the part after 'wp-content'
$this->source_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $lessfile_in_theme;
$this->source_uri = $this->stylesheet->src;
$this->target_path = self::$upload_dir.$target_file;
$this->target_uri = self::$upload_uri.$target_file;
$this->setSourceTimestamp(filemtime($this->source_path));
} |
I have same Problem with Multisite. I used Plugin "wordpress-mu-domain-mapping", so i can www.multisite.com/site1 -> www.site1.com mapping. content_url() return http://www.multi.com/site1/wp-content, but $this->stylesheet->src is http://www.site1.com/wp-content..... My solution ist use filter content_url
|
@sliu2016 Your solution totally worked for me!! I was freaking out, I owe you a beer :) Thanks a lot! |
@schnoggo after over a year I finally came back to this issue ... |
Hi,
I'm getting errors when I'm using WP-LESS with WP multisite. I've created a fix for it:
Replace line 87 in "Stylesheet.class.php" from:
$this->source_path = WP_CONTENT_DIR.preg_replace('#^'.content_url().'#U', '', $this->stylesheet->src);
To:
$this->source_path = WP_CONTENT_DIR.str_replace('/wp-content','',parse_url($this->stylesheet->src,PHP_URL_PATH));
It would be nice if you change this in a feature version.
The text was updated successfully, but these errors were encountered: