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 Converting Static HTML into WordPress Templates Convert Pages Template

Luke Travis
Luke Travis
2,887 Points

What type of wordpress component is a "content-{custom-name}.php" file?

<p>In the "Converting Static HTML into Wordpress Templates" lesson, the instructor creates a new custom file called "content-testimonials.php", and then includes it with the function get_template_part()</p>

<p>My question is, what type of content piece is this? Page? Post? Category? I can't find anything that seems to allow for that type of naming convention in the whole wordpress heirarchy. If it's a post type, how does worpress process the name, and why wouldn't the instructor follow the naming convention of "single-testimonial"?</p>

1 Answer

There is a lot to your question... I'll try to answer it all.

The content-{post-type}.php naming convention is for custom post types as you suggested.

You would the single-{post-type}.php if you wanted to display a single post in a custom post type.

You might check out the stackoverflow post for more info...

http://stackoverflow.com/questions/17968011/custom-layouts-for-custom-post-types-wordpress

Hope this helps clear it up some... If not sorry this is my first attempt at answering someone's question.