My file is in i.e in domain.com/wp-content/Themename/css/cssfile.css
But for example css files are looked in domain.com/css/cssfile
How to change this? The site isn't loading anything properly because of this!
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityMy file is in i.e in domain.com/wp-content/Themename/css/cssfile.css
But for example css files are looked in domain.com/css/cssfile
How to change this? The site isn't loading anything properly because of this!
I assume you are adding your stylesheets like this in your header:
<link rel="stylesheet" type="text/css" href="css/style.css">
Which won't work. To construct the path dynamically, you need to use the PHP functions offered for this. Make sure your header has <?php wp_head(); ?>
in it, and then enqueue your style in your theme's functions.php
file as follows:
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
function enqueue_my_styles() {
wp_enqueue_style ( 'style-name', get_template_directory_uri() . '/css/style.css' );
}
This will automatically prepend the theme's URI to your CSS file, and output it in your theme's header.
wp-content/themes/Coming Soon/css/loader.css