Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development WordPress Header and Footer Templates The header.php and footer.php Files

I'm not getting Header and footer in my site

Hey, I'm not getting Header and footer in my site instead it's showing irrelevant sentences. My site looks like:

jazibshahzad just another wordpress site Index file
jazibshahzad is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

I have following codes in my files:

index.php contain: <?php get_header(); ?> <h1>Index file</h1> <?php get_footer(); ?>

header.php contain: <p>Header</p>

footer.php contain: <p>Footer</p>

I don't know why it's not showing my header and footer and is showing irrelevant statements.

5 Answers

Stanley Thijssen
Stanley Thijssen
22,831 Points

Hey Jazib.

It sounds like you didnt create a header.php file and a footer.php. You should create both of these files and include your header code and footer code inside them.

The messages your seeing now are the default messages you get when you didnt create both header.php and footer.php files.

Could you show us the code inside of index.php?

<?php get_header(); ?>
<h1>Index file</h1>
<?php get_footer(); ?>

Are you editing existing files or did you make a child theme? Your code should work, if you go to a page on the site is it different?

I'm making my own and working on local server using xampp

Is the theme in the admin panel set to the one you are currently working on?

Oliver Williams
Oliver Williams
6,278 Points

The header and footer will only show up on pages using the index.php template. If you have created of .php template files you will also need to add get_header() and get_footer() to them to see it show up on other pages.