Skip to content
Advertisement

Functions.php not load style.css

Not sure what I’m doing wrong here. Whatever I try it won’t load the css. It makes no sense to me as my code is exactly the same as all examples I’ve seen.

In header.php I have the following

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Web Design and Web Development">
    <meta name="robots" content="index,follow">
   <?php wp_head();?>
    
    <title>Hello</title>
</head>

In functions.php I have the following

<?php

function load_stylesheets()
{
    wp_register_style('css', get_template_directory_uri() . '/style.css', null, 1, 'all');
    wp_enqueue_style('css');
}

add_action('wp_enqueue_scripts', 'load_stylesheets');

Advertisement

Answer

It works now. It was an error on my behalf. I had the wrong location path of style.css

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement