0

I would like to ask why my stylesheet is not showing on the page source of the webpage. Please see the code below, that's the code in my functions.php.

`function theme_styles() {

        wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );
    }

    add_action( 'wp_enqueue_scripts', 'theme-styles' );`

I believe I have entered the code correctly but whenever I right click on the webpage and look for the source code, my stylesheet is not showing. I am using WebMatrix by the way and my style.css is under the themes folder that I am currently working on. I am new in WordPress and I'm trying to create my own custom theme. Any help will be highly appreciated.

Thank you so much,

Gilbert Jacob

3 Answers 3

2

Try This :

wp_enqueue_style( 'themename-style', get_stylesheet_uri() );
1

Try this:

function my_theme_load_resources() {
    $theme_uri = get_template_directory_uri();
    wp_register_style('style_css', $theme_uri.'/style.css', false, '0.1');
    wp_enqueue_style('style_css');
}
add_action('wp_enqueue_scripts', 'my_theme_load_resources');
0

Never mind, I noticed that my theme_styles is using an underscore and the one I use in action is theme-styles. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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