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 How to Build a WordPress Theme WordPress Theme Functions The WordPress Loop

Wordpress not recognizing new pages

As I'm working through Zac's "Creating a Wordpress Theme" tutorial, I've ended up stuck because Wordpress isn't recognizing the appearance of the php files as pages automatically, and I don't know how to do it manually. Any ideas?

UPDATE: I did find a manual way of adding them: by manually typing in the address of each page; when it is loaded it is added to the pages list.

7 Answers

Kiko Doran
Kiko Doran
4,752 Points

He's not really creating pages in php. He's creating page templates. He's making special front_page and home files for page template files. They aren't actually "pages" like you've known to come and love. The way I like to explain them is they change out the main content area of your site based on which page you are trying to see. You can learn about page templates here in the codex: http://codex.wordpress.org/Stepping_Into_Templates Also the hierarchy of which template will be used in the template hierarchy: http://codex.wordpress.org/Template_Hierarchy

Hope that helps a little... Kiko

Thanks for all your help. On a whole other subject, I need help with another issue: what's the best way to add a custom CSS file to a template?

Kiko Doran
Kiko Doran
4,752 Points

It might be a "terminology" issue that makes this not clear to me. To add pages, you do that thru the WordPress admin not as individual php files.

I'm thinking you might mean they aren't showing up in your navigation?

If you can give a little more info about your question, I'd be glad to help out.

You are right that normally pages are created in the WP Admin and not through actual php files. However, that's not what Zac appears to have done in the videos. He created the .php files, and then goes to the WP Admin panel and poof! they're there. He then uses this as a means of demonstrating that his changes to pages in the WP hierarchy like home.com have taken effect.

It's not a terminology issue: it's that Zac is accessing the php files from the WP Admin like they are normal pages, without showing how he got them in there in the first place. I assume there's a way to do that, but he doesn't show it in his lessons, so there's a missing step in his tutorial. Right now I've decided to try starting with the standard 2014 theme and simply copy it and then customize it to my liking, because i lost a stinking day on trying to figure out what the heck he did.

Kiko, please note comment reply to your response/query.

Kiko Doran
Kiko Doran
4,752 Points

I haven't done all of the WordPress lessons but I'm pretty well versed in WordPress already. Shoot me a link to the video. I'd like to check it out and see if I can help you demystify it for the future.

Kiko, here's the link to the video. It's on the WP Loop (which I fully understand since it is basic programming). The mystery hits at 5:15 and following.

http://teamtreehouse.com/library/how-to-build-a-wordpress-theme/wordpress-theme-functions/the-wordpress-loop-2

Kiko Doran
Kiko Doran
4,752 Points

Also if you aren't getting front_page or home on the page you expect, check your settings>reading settings.

Kiko Doran
Kiko Doran
4,752 Points

It won't let me answer your other question. The best way is to enqueue a script and include it in your code. Here's some info on it: http://codex.wordpress.org/Function_Reference/wp_enqueue_script You should actually enqueue style but script works for either a javascript or a css file. Here's the enqueue style stuff: http://codex.wordpress.org/Function_Reference/wp_enqueue_style

There are examples for each. Hope it gets you off the ground. WordPress is easy to get started but can be tough to get over the humps. Keep asking questions in the forums. You should start a new question each time so it can help others with the subject line. Good luck Drew!

Kiko