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,731 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!