1

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!

  • what is the theme ? – mmm Nov 13 '17 at 21:47
  • github.com/technext/Imminent?files=1 This is the bootstrap theme. Site loaded on is fitclaw.com if you go to view source you are going to see where does it search for css js files .. – Le Krenqo Nov 13 '17 at 21:49
  • when I look the source of the site, I see the good URL for ressources from theme, like wp-content/themes/Coming Soon/css/loader.css – mmm Nov 13 '17 at 23:01
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.