wp_enqueue_style built in styles

I’m a little confused by your question, can you not simply use wp_enqueue_style, which you actually wrote into this threads heading(not sure if you know the function exists or not). wp_enqueue_style works in the same way as the wp_enqueue_script counterpart, but of course as you’d expect, enqueues stylesheets.. Here’s a list of the enqueues i … Read more

Enqueued Stylesheets Effecting Admin Styles

You could do it like this: function theme_styles(){ /* * This if() statement is unnecessary, as wp_enqueue_scripts * doesn’t fire on the admin pages. * if( is_admin() ) { * return; * } */ wp_enqueue_style( ‘theme-styles’, get_template_directory_uri() . ‘/css/all.css’, array(), false, ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘theme_styles’ ); References is_admin() Also, note that the wp_enqueue_scripts … Read more

add a CSS id to the body of a page in wordpress

Put this in your functions.php → <?php function body_id_dynamic() { if (is_home()) { echo ‘ id=”home”‘; } elseif (is_single()) { echo ‘ id=”single”‘; } elseif (is_search()) { echo ‘ id=”search”‘; } elseif (is_archive()) { echo ‘ id=”archive”‘; } } ?> and then this → <body<?php body_id_dynamic(); body_class(); ?>> P.S. → More customization is possible. This … Read more

CSS in child theme not getting loaded

Parent vs Child Themes get_template_directory_uri always refers to the parent theme you can verify this as you always should when things don’t load as expected by looking in the console in the browsers dev tools. These would show 404 errors for the CSS files, in the wrong folder. Instead, use get_stylesheet_directory_uri, the stylesheet family of … Read more

Exclude stylesheet from admin

There are a couple of options. One is to wrap the enqueue in a check to see if it is the admin. if(!is_admin()) wp_enqueue_style(….); The other is wait to enqueue the style until template_redirect. function my_enqueue_styles() { wp_enqueue_style(….); } add_action( ‘template_redirect’, ‘my_enqueue_styles’ );