How does one load style.css into a theme?

Make sure you have the files named and labeled correctly and in the right place. functions.php located @ mytheme/functions.php <?php /** * Theme Functions */ function theme_name_scripts() { wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); } add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ ); style.css located @ mytheme/style.css /* Theme Name: Twenty Thirteen Theme URI: http://wordpress.org/themes/twentythirteen Author: the … Read more

What is the correct way to enqueue multiple CSS files?

The wp_enqueue_style() function uses the following format and parameters: wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media=”all” ); In your case, you could try the following: <?php /** * Proper way to enqueue scripts and styles */ function namespace_theme_stylesheets() { wp_enqueue_style( ‘mamies-wafers-bootstrap-min’, get_template_directory_uri() .’/css/bootstrap.min.css’, array(), null, ‘all’ ); wp_enqueue_style( ‘mamies-wafers-carousel’, get_template_directory_uri() … Read more

Issues enqueueing parent & child theme stylesheets with revised Codex method

QUESTION 1 Is it safe to include the assumption that parent themes properly enqueue the child theme styles, from the standpoint of child theme standards? General rule of thumb, yes. But, you should never assume. Most disasters and failures in live are due to assumptions or facts based on an assumption FACTS WITHOUT ASSUMPTIONS A … Read more

WordPress admin stylesheet

Take a look here at the CODEX for an example on how to do this very thing. Example: Load CSS File on All Admin Pages function load_custom_wp_admin_style(){ wp_register_style( ‘custom_wp_admin_css’, get_bloginfo(‘stylesheet_directory’) . ‘/admin-style.css’, false, ‘1.0.0’ ); wp_enqueue_style( ‘custom_wp_admin_css’ ); } add_action(‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’); Example: Target a Specific Admin Page function my_enqueue($hook) { if( ‘edit.php’ != $hook ) … Read more

How can I de-register ALL styles all at once? And same with Javascript?

I hope you know what you are doing. You can use the wp_print_styles and wp_print_scripts action hooks and then get the global $wp_styles and $wp_scripts object variables in their respective hooks. The “registered” attribute lists registered scripts and the “queue” attribute lists enqueued scripts on both of the above objects. An example code to empty … Read more

How to enqueue style before style.css

Enqueue the style.css too, and set normalize as dependency: if ( ! is_admin() ) { // Register early, so no on else can reserve that handle add_action( ‘wp_loaded’, function() { wp_register_style( ‘normalize’, // parent theme get_template_directory_uri() . ‘/css/normalize.css’ ); wp_register_style( ‘theme_name’, // current theme, might be the child theme get_stylesheet_uri(), [ ‘normalize’ ] ); }); … Read more