21 comments found

Hello,

In multisite configuration, there is a problem with options.css generation. The admin function script generate option.css inside template folder instead of blog folder.

So I change the admin function script to generate options.css correctly. function generate_options_css($newdata) { $smof_data = $newdata; $uploads = wp_upload_dir(); $css_dir = get_template_directory() . '/assets/css/dynamic-css/'; // Shorten code, save 1 call ob_start(); require($css_dir . 'style.php'); $css = ob_get_clean(); /** Save on different directory if on multisite **/ if(is_multisite()) { $css_dir = $uploads['basedir'] . '/'; wp_register_style('options', $uploads['baseurl'] . '/options.css', 'style'); } else { wp_register_style('options', get_template_directory_uri() . '/assets/css/dynamic-css/options.css', 'style'); } WP_Filesystem(); global $wp_filesystem; if ( ! $wp_filesystem->put_contents( $css_dir . 'options.css', $css, 0644) ) { return true; } }

Regards.

by
by
by
by
by
by