How can I use one stylesheet for multiple sub-sites on my multi-site network?

First off, you’ll obviously need to be using the same parent theme for all sites. You then set up each sub-site with a child-theme for that parent theme. To use the same stylesheet on multiple sites, add the following code to the functions.php file of each sub-site: function import_shared_style_sheet() { wp_enqueue_style( ‘shared-style-sheet’, content_url( ‘/themes/SOURCE-THEME/style.css’) ); … Read more

custom css for admin only

The code that you’ve tried already adds the role CSS class to the admin_body_class, which only affects the admin area/backend. Simply change the filter to alter the frontend body class body_class, eg. function wpa66834_role_admin_body_class( $classes ) { global $current_user; foreach( $current_user->roles as $role ) $classes .= ‘ role-‘ . $role; return trim( $classes ); } … Read more

CSS not affecting widget output

The problem was due to an incorrect file path in the movieposterdisplay-scripts file. Whilst the file loaded correctly in the main php file require_once(plugin_dir_path(__FILE__).’/includes/movieposterdisplay- class.php’); as it already assigned the correct plugin folder name. It did not enqueue correctly as the code was wp_enqueue_style(‘mpd-main-style’, plugins_url().’/movieposterdisplay/css/style.css’); and I had previously changed the folder name. Hence I … Read more

How to display custom style based on theme option select box

Just put your dynamic CSS inside of a callback function, hooked into wp_print_script, e.g. function mytheme_custom_css() { ?> <script type=”text/css”> <?php if ( of_get_option(‘show_post_sidebar’, true ) ) { ?> .post{width:720px} <?php } ?> </script> <?php } add_action( ‘wp_print_scripts’, ‘mytheme_custom_css’ ); Add as few, or as many, conditional CSS rules as you need.

jQuery UI styles conflicting with TinyMCE dialog

It should work just fine if you enqueue your script & stylesheet within functions.php file. This is how I do that (feel free to copy & paste, it should work out of the box): function load_my_admin_js() { wp_register_script(‘jquery-ui’,”https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js”); wp_enqueue_script(‘jquery-ui’); } add_action(‘admin_init’, ‘load_my_admin_js’); function load_my_admin_css() { wp_enqueue_style( ‘jquery-ui’, ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css’); } add_action( ‘admin_print_styles’, ‘load_my_admin_css’); Don’t forget to … Read more

404 error on dynamic stylesheet creation

The solution you’re using to get the stylesheets onto the page is a terrible method. WordPress provides the enqueue functions specifically to do what you’re trying to do. The codex page on wp_enqueue_style() explains exactly what you need to do. If you would like to add a dynamic version, there is a parameter for that.

Trying to figure out why my child theme is trying to access a file that doesn’t exist

From your comment: I found this code in the functions.php of the parent theme, is that what you were looking for? // bootstrap wp_register_style(‘bootstrap’, get_template_directory_uri() . ‘/css/lib/bootstrap.css’); > wp_enqueue_style(‘bootstrap’); In your Theme’s file structure, do you find /css/lib/bootstrap.css? If so, then it should be loading properly. If not, do you find bootstrap.css anywhere else in … Read more