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 WordPress Theme Development Adding a Blog to a WordPress Theme The single.php Page

Single.php is affecting the custom post types layout too...

Is there a way to avoid that?

2 Answers

Garrett Sanderson
Garrett Sanderson
12,735 Points

Hi Hector, when you have a custom post type and you are using your own page you need to declare its own single.php.

If you throw the custom post type into any page and don't specify its own single page you will automatically default to single.php

For example, say you have a custom post type called portfolio.

If there is no other file that is a single it will default to single.php so you need to set up a new single.

The single for this page would be single-portfolio.php. so single-slug.php is what you want to remember.

Hope this helps

Thank you for your answer!