Why is my CSS not loading?

时间:2018-04-30 作者:Nicolas Ccflier

I have the following code on my wordpress page but none of it is being formatted by the style.css file. Everything is in a folder titles \'Web Services\' that i place directly into the wp-content/themes folder. All it does is print the plain text.

Header.php:

    <meta name="description" content = "Welcome to Flier Web Design!" />
    <meta name="keywords" content = "Premium, Web, Design, Web Design, fast, easy" />
    <meta name="author" content = "Corey" />
    <title>Our PHP Template</title>
</head>
<body>
    <div id="header">
        <div id="logo">
        <p>LOGO</p>
        </div>
    </div>
    <div id="hsubcribe">
        <p>Header Subscribe</p>
    </div>
    <div id="navbar">
        <p>navbar</p>
    </div>

sidebar:

<div id="sidebar">
<p>sidebar</p>
</div>

footer.php:

<div id="footer">
<p>footer</p>

functions.php:

index.php:

<?php get_header(); ?>

<div id="content">
<div id="contentleft">
<style>font-size: 300px;</style>
    <p>indexpage</p>
</div>

<?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>

style.css:

/*
Theme Name: Web Services
Author: Corey
Description: First Template
Version: 1.1
License: None
License URI: http://flierwebdesign.com
Text Domain: flierwebdesign
*/

body {
margin: 0px;
padding: 0px;
background-color: yellow;
font-family:Calibiri, Arial, Tahoma;

}
#header {
width: 900px;
margin: 0px auto 0px auto;
border: 1px solid #000;
clear: both;
}
#logo {
width: 400px;
float: left;
border: 1px solid #000;
}

#hsubscribe {
width: 400px;
float: right;
border: 1px solid #000;
}
#navbar {
width: 900px;
margin: 0px auto 0px auto;
border: 1px solid #000;
clear: both;
}
#content {
width: 900px;
margin: 0px auto 0px auto;
border: 1px solid #000;
clear: both;

}
#contentleft {
width: 900px;
margin: 0px auto 0px auto;
border: 1px solid #000;
clear: both;
}
#sidebar {
width: 300px;
float: right;
border: 1px solid #000;
}
#footer{
font-size: 300px;
width: 900px;
margin: 0px auto 0px auto;
border: 1px solid #000;
clear: both;
}
1 个回复
最合适的回答,由SO网友:Bikash Waiba 整理而成

您需要添加wp_head() 关闭前挂钩<head> 标题处的标记钩子,其中将动态添加所有排队的文件。检查https://developer.wordpress.org/reference/functions/wp_head/

也别忘了把wp_footer() 在您的页脚。php文件。看见https://codex.wordpress.org/Function_Reference/wp_footer

结束