Lightcoder
Lightcoder

Reputation: 263

Custom WordPress Theme isn't picking up the style.css file

I have just followed a tutorial about creating custom WordPress theme, each and everything went just fine from static to dynamic conversion but when I activate that theme and I come up with a plain HTML document with blue hyperlinks which mean the site is not picking up the css file of style.css

Am I doing something wrong? Please help me.

Upvotes: 0

Views: 3540

Answers (2)

jtheman
jtheman

Reputation: 7491

Check your source HTML and see that the path to your CSS is correct.

You can use bloginfo() to find the correct path by using:

<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/style.css">

If your style.css resides in the root folder of your template.

Upvotes: 2

Mark
Mark

Reputation: 3055

Where did you add the link to the file? - View the source of the page to see if the link is there and try navigating to it to see if it returns a 404 (Not Found) or other error.

My preferred way to include theme stylesheets is adding something like this to my functions.php.

add_action('wp_enqueue_scripts','enqueue_my_styles_scripts');

function enqueue_my_styles_scripts() {
    wp_enqueue_style('my-styles',get_stylesheet_directory_uri().'/style.css');
}

Check out wp_enqueue_style and make sure you have a wp_head() call in your header file

Upvotes: 0

Related Questions