WordPress doesn’t include css

I want load a custom css in the index.php file, this is my code in function.php

if(! function_exists('basictheme_styles_scripts')) {
    function basictheme_styles_scripts() {
        wp_enqueue_script('jquery');
        wp_enqueue_style('basictheme-opensans', '//fonts.googleapis.com/css?family=Open+Sans');
        wp_enqueue_style( 'basictheme', get_template_directory_uri().'/style.css');

    }
}
add_action('wp_enqueue_scripts','basictheme_styles_scripts');

but perhaps something is wrong, beacause my index doesn’t load it

1 Answer
1

You’ve placed the relevant code inside function.php, but WordPress loads functions.php

You’re also missing some indenting which makes syntax errors much more likely to occur, and you can save some typing by using get_stylesheet_uri() instead of get_template_directory_uri().'/style.css'

Leave a Comment