I just started building a custom theme so I only have the core files with a header.php
and footer.php
file.
So far all I've done in my functions.php
file is enqueue my css and js so I haven't added any theme support for anything.
So far my files look like this:
header.php
<!doctype html>
<html>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<header class="testB">
<p>header section</p>
</header>
footer.php
<footer>
<p>footer</p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
index.php
<?php get_header(); ?>
<p class="test">body</p>
<?php get_footer(); ?>
So far the only markup that displays is the <p>body</p>
in the index.php
file.
I studied the code to the twentytwentyone theme and don't see anything that particularly appears to enable the ability for our markup to render.
I haven't created any other template parts yet besides the header and footer.
The only thing I'm doing differently is instead of having the header and footer in the root directory I have them in a folder called framework
and in their respective folders.
So for example the path to the header from the root directory is framework/header/header.php
.
Is there a WP standard that says that has to be in the root directory?
I come from an Angular background so I prefer to sort every tiny chunk of code into their own folders and sub folders.
Can any of you spot what I'm doing wrong here?
require
orget_template_part
to get theheader.php
if its inside a folder/sub-folder. WordPress searchesheader.php
,footer.php
and a few others in the root of your theme and no where else.