Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress How to Make a Website with WordPress Custom Post Types and Fields in WordPress Custom Post Type Templates

Amanda Harris
Amanda Harris
508 Points

Where are the original .php files located (or should be located) for my newly-created custom posts?

I am new to WP, and am just learning about custom posts. In the video, it shows the new .php files as being located in the original WP downloaded folder, under the child theme folder. I made the new post entitled "Art", but cannot locate this anywhere, either on my desktop, or on the Bluehost server. What did I do wrong, and what is the right way to create custom posts so that the .php files will appear in the correct location?

3 Answers

Amanda Harris
Amanda Harris
508 Points

@Mark Christiansen, thanks for wording this question much better than I had. I also feel as if downloading the files from the video downloads would be skipping some important step, but for the sake of continuing, I'm going to use the downloaded files. I also followed along with the video, but I still don't see the files art.php, content-art.php, single-art.php.

@Sean T. Unwin, thanks for your response, though I'm not sure if I fully understand where those custom post files should be located; they are not in the folder (on the server or working directory) for the child theme I'm using, as it showed in the video.

Sean T. Unwin
Sean T. Unwin
28,660 Points

If you have followed along with the video, you should have art.php, content-art.php, single-art.php in your working directory and/or server. Following that you would have created an 'Art` page from within the WP Admin area and set it to the Art page template in the Page Attributes section.

If this is the part to which you are referring to then what you have just created in the admin area is stored in the database, not in a physical file on the server. It is using the template file, which is a physical file on the server, although the content of that page is stored within the database. I can understand how that can be confusing in the beginning.

So to recap:

  • Page templates are on the server

  • Pages which are created from within the admin area are stored in the database, similar to posts

    • These pages are not part of your theme, which the physical files are -- the physical files are the templates
    • These pages use either custom templates or if not Wordpress looks to use the page.php template to contain the contents of the page you created from within the admin.

I hope this helps to clear things up a little.

Hey Sean,

I'm working on a live site that I was never hosted locally. I've installed both of these plugins and followed along with the video. I don't have an Art page template in the page attributes section. Where can I access the physical files art.php, content-art.php, and single-art.php to place them in my child-theme?

Thanks for you help!

-nick

Sean T. Unwin
Sean T. Unwin
28,660 Points

Hi Nick Nemethy,

You can grab the files from the downloads section beneath the video on the lesson page. Beneath the video click 'Downloads' then download the .zip.

I had the same question. I installed the plugins and activated them, created everything said in the video, but when I log on to my FTP, I cannot see art.php, content-art.php or single-art.php on my remote server.

It feels like i'm skipping a step if I just download these files from the video downloads.

Hey @Sean T. Unwin,

Can I find these files without downloading them from the video downloads? Or would I have to custom the project downloads to fit different types of posts?

Sean T. Unwin
Sean T. Unwin
28,660 Points

Up to you I suppose, though I may not fully understand your second question.

Download the files and edit them to your liking or create new ones based on that particular course if you're so inclined and have an idea of what you want to end up with. Downloading would give you a base already to start from, however.