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 trialSteve Slade
3,530 Pointspages in wp-admin
While following these tutorials, I've managed to make everything work as shown (a miracle indeed). However, I have come across a problem. I created all the .php files as outlined in a previous video, but when I go into wp-admin, all I see is the sample page. The front-page.php file is active as I can see all the content, I just don't see the list of pages.
I know how to make a page in the dashboard. However, the page doesn't correspond to the files I created. Am I supposed to have created the pages before this?
I am using the latest wp build: version 3.8.1
Any help on this would be greatly appreciated.
Steve
10 Answers
Christopher Mell
9,152 PointsCreate the pages in the admin and under 'Page Attributes" select the .php template for that page. Even though you created the .php file, you need to add the page to the db by adding new pages with the templates.
Steve Slade
3,530 PointsThanks Christopher for the answer.
I do have a follow up question (please excuse my ignorance): I do not see my .php templates listed. Is there a way to surf to them?
Steve Slade
3,530 PointsI looked on the codex, and it shows a template option under the normal page selection. Unfortunately on my screen, that option is not available. I'll keep looking.
Thanks for your help.
Christopher Mell
9,152 PointsAre your .php template files in the correct folder?
Steve Slade
3,530 PointsThey are in the main theme folder I created. I don't have them in any subfolders as of yet.
Steve Slade
3,530 PointsAlso, I'm running this locally with MAMP, so I shouldn't have any security issues or other server-side issues.
Steve Slade
3,530 PointsOK the menu now appears under quick edit. Now, none of the files are listed there.
Christopher Mell
9,152 Points/**
* Template Name:PageofPosts
*
*
*
* @package ThemeName
* @since ThemeNameVersion 1.0
*/
Do you have something like this at the top of your .php template files so Wordpress knows they are template files and what the template name is?
Steve Slade
3,530 Points I didn't, but looking at the files in the project folder I downloaded from Treehouse, Zac doesn't either. Also, his blog page comes up with several different generic blog postings. Mine comes up with the same thing as my home page. There is still something I'm missing. But I'm glad I have the first hurdle completed.
Steve Slade
3,530 PointsOK I found the answer. I have to put <?php /* Template Name: My Custom Page */
at the top of each of my pages. Then, they show up. That would be a nice thing to have in the notes of the tutorial, or as a comment. Maybe that is common knowledge…wasn't for me.
Christopher Mell
9,152 PointsI thought that might be the issue. Glad you got it figured out.
Christopher Mell
9,152 PointsGo to Settings->Reading and check what the 'Front page displays' is set to. It will be 'Your latest posts' or you can select 'A static page'. Do you have a separate template for your home page and blog page? If so, what are the template names?
Steve Slade
3,530 PointsThe front page is set to static. I did realize that it was posting a generic blog. The thing that threw me is that it was only displaying one post instead of the three that the video shows.