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 trialDebby Beachy
Courses Plus Student 2,096 PointsFatal 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
Debby Beachy
Courses Plus Student 2,096 PointsHi Rich, yes I do
Rich Bagley
25,869 PointsCould you post line 1 of index.php and header.php please?
-Rich
Agustin Grube
39,278 Pointsis 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
Courses Plus Student 2,096 PointsOKay Rich I will take a look at the links that you gave me. Thank.
Rich Bagley
25,869 PointsNo problem, let us know how it turns out :)
Rich Bagley
25,869 PointsHi 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:
- http://stackoverflow.com/questions/25979528/fatal-error-call-to-undefined-function-get-header-in-c-xampp-htdocs-hypersho
- https://wordpress.org/support/topic/php-fatal-error-call-to-undefined-function-get_header-1
- http://css-tricks.com/forums/topic/wordpress-error-call-to-undefined-function-get_header/
Hope that makes some kind of sense :)
-Rich
Debby Beachy
Courses Plus Student 2,096 PointsHi Rich, I started all over (which was good) and I came up with the same error. So here is an image of my code.:
What am I doing wrong? Thanks for all the input on helping!
Rich Bagley
25,869 PointsHi Debby,
Is your index.php in the root of your site or located in wp-content > themes > theme-directory-here?
-Rich
Debby Beachy
Courses Plus Student 2,096 PointsI 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:
Rich Bagley
25,869 PointsHi 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
Courses Plus Student 2,096 PointsOMG... 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.
Rich Bagley
25,869 PointsCan you post the new error please?
Debby Beachy
Courses Plus Student 2,096 PointsRich 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
Rich Bagley
25,869 PointsHi 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
1,524 PointsHi everybody I am facing the same issue. Fatal error. can someone help me plz?
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHi Debby,
Do you have a header.php?
-Rich