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

Debby Beachy
PLUS
Debby Beachy
Courses Plus Student 2,096 Points

Fatal error:

I'm getting an Fatal error warning when viewing in my local host:

Can I have some help with this please? Thanks

Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\buildWordpress.com\index.php on line 1

Hi Debby,

Do you have a header.php?

-Rich

Could you post line 1 of index.php and header.php please?

-Rich

Agustin Grube
Agustin Grube
39,278 Points

is the header.php empty?

Can you paste the contents of your header.php here using ``` markers above and below the code so we can see.

Refer the the "Markdown CheatSheet" below the comment box to see how to post code.

6 Answers

Debby Beachy
PLUS
Debby Beachy
Courses Plus Student 2,096 Points

OKay Rich I will take a look at the links that you gave me. Thank.

No problem, let us know how it turns out :)

Hi Debby,

I can see the error but can't see the code from line 1 of the index.php and header.php files unfortunately so it may not have copied correctly.

Out of curiosity have you edited the index.php in the root of the website (different to the theme's index.php)? If so this could be the cause of the problem.

The index.php in the root of the site would normally remain as it is. You'd then only edit the index.php within your theme directory (wp-content > themes > theme-directory-here) to include get_header(), etc.

The following may also help:

Hope that makes some kind of sense :)

-Rich

Debby Beachy
PLUS
Debby Beachy
Courses Plus Student 2,096 Points

Hi Rich, I started all over (which was good) and I came up with the same error. So here is an image of my code.: Imgur

Imgur

What am I doing wrong? Thanks for all the input on helping!

Hi Debby,

Is your index.php in the root of your site or located in wp-content > themes > theme-directory-here?

-Rich

Debby Beachy
Debby Beachy
Courses Plus Student 2,096 Points

I copied it over from the lesson so it's in:

wp-content>themes>treehousePortfolio this is where my functions.php file is

This is what the error looks like: Imgur

Hi Debby,

Your enqueued styles are missing quotes around /css/foundation.css and /css/normalize.css.

That should hopefully help to sort it.

The Codex has examples on this for reference.

Hopefully that helps :)

-Rich

Debby Beachy
Debby Beachy
Courses Plus Student 2,096 Points

OMG... I can't believe how long I stared at my code and couldn't see it! But now it's saying I have other errors on line 18.

Can you post the new error please?

Debby Beachy
PLUS
Debby Beachy
Courses Plus Student 2,096 Points

Rich I'm happy to say I found all the errors in my code and it's working perfectly now! How can I learn to be more focused on details such as this? Thanks db

Hi Debby,

Glad you got it sorted. In this instance I looked to the first '/' on line 3 of functions.php and spotted that the quotes were missing.

If I didn't know the quotes were supposed to be there I would have compared it with the example code from the Codex to see if I could spot any differences between them.

Hope that helps :)

-Rich

Chandresh Singh
Chandresh Singh
1,524 Points

Hi everybody I am facing the same issue. Fatal error. can someone help me plz?