My CSS suddenly doesn’t load anymore [closed]

You should remove an additional } on line 18. Try the following <?php if (!function_exists(‘understrap_scripts’)) { /** * Load theme’s JavaScript and CSS sources. */ function understrap_scripts() { // Get the theme data. $the_theme = wp_get_theme(); $theme_version = $the_theme->get(‘Version’); wp_enqueue_style(‘slider-slider-styles’, ‘https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css’); wp_enqueue_style(‘lity-style’, ‘https://cdnjs.cloudflare.com/ajax/libs/lity/2.4.1/lity.min.css’); $css_version = $theme_version . ‘.’ . filemtime(get_template_directory() . ‘/css/theme.min.css’); wp_enqueue_style(‘understrap-styles’, get_stylesheet_directory_uri() . … Read more

How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)

Try using is_post_type_archive() and is_singular(): // … if ( is_post_type_archive( ‘my-post-type’ ) || is_singular( ‘my-post-type’ ) ) { // your enqueue code goes here } // … These functions will check to see if you’re on, respectively, an archive page for the post type my-post-type or a single my-post-type post. (Change the my-post-type to what … Read more

Custom WordPress Theme loads js but not stylesheets

Theres no such hook as wp_enqueue_style. Stylesheets need to be enqueued on the wp_enqueue_scripts hook, as seen in the documentation. So this: add_action( ‘wp_enqueue_style’, ‘test_enqueue_styles’); Needs to be: add_action( ‘wp_enqueue_scripts’, ‘test_enqueue_styles’); I’d also suggest reviewing the documentation on hooks, to understand what add_action() does.

make admin.css in my child theme

The get_template_directory_uri() function gets the URL to the parent theme. The equivalent function for child themes is get_stylesheet_directory_uri(). However these days the proper function to use to get the URL for a file in a child theme is get_theme_file_uri(): function wp245372_admin_enqueue_scripts() { wp_enqueue_style( ‘my-admin-css’, get_theme_file_uri( ‘my-admin.css’ ) ); } add_action( ‘admin_enqueue_scripts’, ‘wp245372_admin_enqueue_scripts’ );

What is the colors handle from WordPress core for and why does it not have a path?

The colors handle is for the “Admin Color Scheme” stylesheet (see the Users → Profile page at wp-admin/profile.php) and it’s registered via wp_default_styles(), like so: ( $styles is an instance of the WP_Styles class which extends the WP_Dependencies class which has an add() method where the second parameter is the stylesheet path ) // Register … Read more

str_replace inside specific css files [closed]

No, because the CSS file isn’t loaded in and parsed by PHP—it’s just “printed” to the browser at the appropriate time. You can, however, add inline styles to an enqueued stylesheet, which you would then be able to manipulate with filters. In the code snippet below, let’s assume you’re using wp-content/plugins/my-plugin/assets/style.css. add_action( ‘wp_enqueue_scripts’, ‘wpse406238_inline_css’ ); … Read more

wp_enqueue_style for plugin options page

the call to add_options_page will return the string literal to use for your RSS, so it should look something like this: $page = add_options_page( … ); add_action( ‘admin_print_styles-‘ . $page, ‘rps_paypal_add_css’ ); More info here: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

Proper use of wp_enqeue_style

Two problems: You only need to provide the script path once, either in the wp_register_style() call, or in the wp_enqueue_style() call, but not both. (In fact, in this context, it would be fine to omit the wp_register_style() call entirely, and just use the wp_enqueue_style() call.) You’re hooking into the wrong action. Try hooking into wp_enqueue_scripots … Read more