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

Parse error: syntax error, unexpected 'get_header' (T_STRING) in Index.phph

Trying to follow the Theme Making course and am running into problems. I get this error Parse error: syntax error, unexpected 'get_header' (T_STRING) in /Applications/XAMPP/xamppfiles/apps/wordpress/htdocs/wp-content/themes/Treehouse-Portfolio/index.php on line 1 when I try to view my site. It can activate just fine.

My code is this: <? php get_header (); ?> line 1

<h1> Index File </h1>

<? php get_footer(); ?>

I dont see anything wrong with it. My WordPress is up to date, I've tried switching themes all to no avail.

2 Answers

Austin Whipple
Austin Whipple
29,725 Points

Hi Pat,

The proper code to include a WordPress header is:

<?php get_header(); ?>

With the footer include being similar:

<?php get_footer(); ?>

Give that a shot. If you're still having trouble, check out this WordPress Codex article on the get_header function.

Thanks for the response!