Anonymous User 357386
(@anonymized-357386)
Sorry, i never tested on multisite… I can try to install a multisite installation in my localmachine and search a fix for it 😉
–
Thanks for report (and also for your rating) 🙂
Thanks for the quick response!
After thinking about it again, the easiest thing would probably be to use a conditional so that if it’s a multisite installation, ignore getting the CSS from the file and just get it from the options table. Messing around with files and site IDs is probably prone to error. I think the Prose theme by StudioPress used to be set up that way (with site IDs) but the latest version just stores the CSS in the database. There’s probably a good reason why they switched.
Just my thoughts.
Anonymous User 357386
(@anonymized-357386)
I’ve problem to setup multisite in my local machine… but my idea is this:
function css_path()
{
if (is_multisite())
{
$css_path = plugin_dir_path(__FILE__)."my_style_id-".get_current_site()->id.".css";
}
else
{
$css_path = plugin_dir_path(__FILE__)."my_style.css";
}
return $css_path;
}
function css_url()
{
if (is_multisite())
{
$css_url = plugin_dir_url(__FILE__)."my_style_id-".get_current_site()->id.".css";
}
else
{
$css_url = plugin_dir_url(__FILE__)."my_style.css";
}
return $css_url;
}
Anonymous User 357386
(@anonymized-357386)
Edit: i think is best like this (to maintain id 1 without id in url), but ATM i can’t test:
function css_path()
{
if (is_multisite() && get_current_site()->id > "1")
{
$css_path = plugin_dir_path(__FILE__)."my_style_id-".get_current_site()->id.".css";
}
else
{
$css_path = plugin_dir_path(__FILE__)."my_style.css";
}
return $css_path;
}
function css_url()
{
if (is_multisite() && get_current_site()->id > "1")
{
$css_url = plugin_dir_url(__FILE__)."my_style_id-".get_current_site()->id.".css";
}
else
{
$css_url = plugin_dir_url(__FILE__)."my_style.css";
}
return $css_url;
}
Anonymous User 357386
(@anonymized-357386)
Edit… ok, i’ve fixed…
This is a valid code (tested in my local machine):
function css_path()
{
global $blog_id;
if (is_multisite() && ($blog_id > "1"))
{
$css_path = plugin_dir_path(__FILE__)."my_style_id-".$blog_id.".css";
}
else
{
$css_path = plugin_dir_path(__FILE__)."my_style.css";
}
return $css_path;
}
function css_url()
{
global $blog_id;
if (is_multisite() && ($blog_id > "1"))
{
$css_url = plugin_dir_url(__FILE__)."my_style_id-".$blog_id.".css";
}
else
{
$css_url = plugin_dir_url(__FILE__)."my_style.css";
}
return $css_url;
}
Anonymous User 357386
(@anonymized-357386)
Fixed with a best control:
function css_path()
{
global $blog_id; $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null;
$css_path = plugin_dir_path(__FILE__)."my_style".$cssid.".css";
return $css_path;
}
function css_url()
{
global $blog_id; $cssid = ( $blog_id > "1" ) ? $cssid = "_id-".$blog_id : $cssid = null;
$css_url = plugin_dir_url(__FILE__)."my_style".$cssid.".css";
return $css_url;
}
I’ve tested more…
Seems to work perfect 😉
Finally got around to testing the upgrade, and it works perfectly. Thanks for the compatibility fix, and for such a quick response!