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

Darren Healy
seal-mask
.a{fill-rule:evenodd;}techdegree
Darren Healy
Front End Web Development Techdegree Student 23,565 Points

Custom Post Type Templates

Zac Gordon

Hey Zac,

In the WordPress development track, I'm currently on the custom post templates video, and I can see there are three new files:

single-art.php content-art.php art.php

My question is this: did you as the developer have to create these? I'm confused as to where they have came from.

Thanks in advance!

jeff creamer
jeff creamer
23,733 Points

Hey Darren,

Yes. those 3 files are not core WordPress files, so the developer creates them. WordPress does come with a page.php and a single.php which you can use as your starting points for your custom templates (like art.php and single-art.php) by copying their contents into your new file and then customizing them to fit your site. Hope that helps!

2 Answers

jeff creamer
jeff creamer
23,733 Points

Page.php and single.php (the theme files used for displaying pages and single posts respectively) are a good starting place for most of any customized content or looks you may need for a WordPress site, but many times with a child theme you can just use some smart CSS or a plugin like Advanced Custom Fields to get a particular look (and thus not need a custom template).

PHP mostly comes into play when you want to customize the WordPress loop for a particular page or add some new actions/filters via the functions.php file, Check out Zac's How to Build a WordPress Theme and Theme Template Hierarchy courses for more solid info.

Darren Healy
seal-mask
.a{fill-rule:evenodd;}techdegree
Darren Healy
Front End Web Development Techdegree Student 23,565 Points

Thanks Jeff, it does help!

So my next question... I guess you need to have more experience in PHP and wordpress development in order to know what files you need to create and then upload/use them in the child theme?

Very new to WP development!