CSS stylesheet not loading
Question
I’m brand new at theme development. My css stylesheet is not loading, and I’m not sure if the problem is in the functions.php, style.css, index.php, header.php, or footer.php file. I’ve added a div class “post-title” in index.php, which should change the font color of my posts, but right now it’s not doing that. My code is below:
functions.php:
<?php
function link_css_stylesheet() {
wp_enqueue_style('style', get_stylesheet_uri());
}
add_action('wp_enqueue_scripts', 'link_css_stylesheet');
?>
style.css:
/*
Theme Name: Richard Theme Name
Theme URI: http://www.intechio.com/themes/Richard-Theme
Author: Richard
Author URI: https://intechio.com
Description: Theme project.
Version: 1.0
*/
.post-title {
color : rgb(0,100,0);
}
index.php:
<?php
get_header();
?>
<div class="post-title">
<?php
if (have_posts()) :
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
else:
echo "No posts.";
endif;
?>
</div>
<?php
get_footer();
?>
header.php:
<!DOCTYPE html>
<html>
<head>
<meta charset=”<?php bloginfo(‘charset’); ?>
<title><?php wp_title(); ?> | <?php bloginfo('name'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<h1><?php bloginfo(‘name’); ?></h1>
<h2><?php bloginfo(‘description’); ?></h2>
footer.php:
<p>this is a footer</p>
</body>
</html>
Thank you in advance for any tips you might be able to offer.
0
3 months
0 Answers
14 views
0
Leave an answer
You must login or register to add a new answer .