首页 > 解决方案 > Functions.php 不加载 style.css

问题描述

不知道我在这里做错了什么。无论我尝试什么,它都不会加载 CSS。这对我来说毫无意义,因为我的代码与我见过的所有示例完全相同。

在 header.php 我有以下

<!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>

在functions.php我有以下

<?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');

标签: phpwordpress

解决方案


现在可以了。这是代表我的错误。我的 style.css 位置路径错误


推荐阅读