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 trialJazib Shahzad
2,243 PointsI'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
22,831 PointsHey 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.
Luke Pettway
16,593 PointsCould you show us the code inside of index.php?
Jazib Shahzad
2,243 Points<?php get_header(); ?>
<h1>Index file</h1>
<?php get_footer(); ?>
Luke Pettway
16,593 PointsAre 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?
Jazib Shahzad
2,243 PointsI'm making my own and working on local server using xampp
Luke Pettway
16,593 PointsIs the theme in the admin panel set to the one you are currently working on?
Oliver Williams
6,278 PointsThe 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.