I am new to wordpress and am trying to develop a child theme on localhost for the first time. I am trying to load style.css using this code in functions.php. This is the entire functions.php file:
<?php
//registers styles in header
function load_stylesheets()
{
wp_register_style('bootstrap', get_stylesheet_directory_uri().'/assets/css/bootstrap.css', array(), false, 'all');
wp_enqueue_style( 'bootstrap');
wp_register_style('style', get_stylesheet_directory_uri().'/style.css', array(), false, 'all');
wp_enqueue_style('style');
}
add_action('wp_enqueue_scripts', 'load_stylesheets');
?>
My style.css file is in my main directory and it has this style in it
body {background-color:black;}
My header.php file is
<!DOCTYPE html>
<head>
<?php wp_head();?>
</head>
<body <?php body_class();?>>
My footer.php file is
<footer>
</footer>
<?php wp_footer();?>
</body>
</html>
When I inspect my homepage source code it shows my style.css is loading but I am not seeing the style applied (the black background).
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<link rel='stylesheet' id='wp-block-library-css' href='http://homepage:8888/wp-includes/css/dist/block-library/style.min.css?ver=5.4.2' type='text/css' media='all' />
<link rel='stylesheet' id='bootstrap-css' href='http://homepage:8888/wp-content/themes/cc/assets/css/bootstrap.css?ver=5.4.2' type='text/css' media='all' />
<link rel='stylesheet' id='style-css' href='http://homepage:8888/wp-content/themes/cc/style.css?ver=5.4.2' type='text/css' media='all' />
<link rel='https://api.w.org/' href='http://homepage:8888/wp-json/' />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://homepage:8888/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://homepage:8888/wp-includes/wlwmanifest.xml" />
<meta name="generator" content="WordPress 5.4.2" />
<link rel="canonical" href="http://homepage:8888/" />
<link rel='shortlink' href='http://homepage:8888/' />
<link rel="alternate" type="application/json+oembed" href="http://homepage:8888/wp-json/oembed/1.0/embed?url=http%3A%2F%homepage%3A8888%2F" />
<link rel="alternate" type="text/xml+oembed" href="http://homepage:8888/wp-json/oembed/1.0/embed?url=http%3A%2F%homepage%3A8888%2F&format=xml" />
When I click on the "http://homepage:8888/wp-content/themes/cc/style.css?ver=5.4.2" it appears that my style of "body {background-color:black;}" is showing but I just don't see it applied to the homepage. It looks like it's being overridden by the Bootstrap's reboot.scss file, which I deleted from my css folder so I'm not sure why it's still showing. Is there also a reason why it is adding "ver=5.4.2" to the end?
EDIT:
I have tried hard refreshing and checked my debug log before I posted this. The debug log says this, but I still don't understand what it's saying and I am following my tutorial video to a T.
thrown in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/homepage/template-parts/content-archive.php on line 27
[28-Jul-2020 04:58:53 UTC] PHP Fatal error: Uncaught Error: Call to undefined function the_exerpt() in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/homepage/template-parts/content-archive.php:27
Stack trace:
#0 /Applications/MAMP/htdocs/homepage.com/wp-includes/template.php(725): require()
#1 /Applications/MAMP/htdocs/homepage.com/wp-includes/template.php(672): load_template('/Applications/M...', false)
#2 /Applications/MAMP/htdocs/homepage.com/wp-includes/general-template.php(168): locate_template(Array, true, false)
#3 /Applications/MAMP/htdocs/homepage.com/wp-content/themes/homepage/index.php(20): get_template_part('template-parts/...', 'archive')
#4 /Applications/MAMP/htdocs/homepage.com/wp-includes/template-loader.php(106): include('/Applications/M...')
#5 /Applications/MAMP/htdocs/homepage.com/wp-blog-header.php(19): require_once('/Applications/M...')
#6 /Applications/MAMP/htdocs/homepage.com/index.php(17): require('/Applications/M...')
#7 {main}
thrown in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/homepage/template-parts/content-archive.php on line 27
[28-Jul-2020 06:24:51 UTC] PHP Parse error: syntax error, unexpected '}', expecting ')' in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/cc/functions.php on line 6
[28-Jul-2020 06:24:51 UTC] PHP Notice: Trying to access array offset on value of type bool in /Applications/MAMP/htdocs/homepage.com/wp-includes/class-wp-recovery-mode-email-service.php on line 339
[28-Jul-2020 06:24:51 UTC] PHP Notice: Trying to access array offset on value of type bool in /Applications/MAMP/htdocs/homepage.com/wp-includes/class-wp-recovery-mode-email-service.php on line 340
[28-Jul-2020 06:26:51 UTC] PHP Parse error: syntax error, unexpected '}', expecting ')' in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/cc/functions.php on line 6
[28-Jul-2020 07:03:18 UTC] PHP Notice: Undefined variable: version in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/cc/functions.php on line 10
[28-Jul-2020 07:03:19 UTC] PHP Notice: Undefined variable: version in /Applications/MAMP/htdocs/homepage.com/wp-content/themes/cc/functions.php on line 10
http://homepage:8888/wp-content/themes/cc/style.css?ver=5.4.2
? You could use the browser Inspect function to see what style is being applied to body and where it came from, just to see if another CSS property might be overriding yours.