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 Make a Website with WordPress Custom Post Types and Fields in WordPress Custom Post Type Templates

Jeffrey Cunningham
Jeffrey Cunningham
5,592 Points

Does not work in Genesis

The templates seem to now work right when using Genesis. I'm using the Genesis sample them. The post type works and even the main archive page works fine, but when I click on the title of a piece of art I get taken to a 404 page. I'm assuming this has something to do with the art-single-php file.

2 Answers

Brian Hayes
Brian Hayes
20,986 Points

Genesis handles custom post templates the same as any other theme, in fact Genesis isn't really the one handling it at all, WordPress still is. With Genesis you are able to use its hooks and main loop if you wish in those template files, but naming them still in the WordPress format.

From the wording in your question I'm assuming you named your custom post single template as art-single.php. If that's true, then you just mixed up the WordPress template naming convention. For single post types the convention is: single-$posttype.php.

For single post types WordPress checks template files as follows: (pulled right from developer.wordpress.com)

The single post template file is used to render a single post. WordPress uses the following path:

  1. single-{post-type}.php – First, WordPress looks for a template for the specific post type. For example, post type is product, WordPress would look for single-product.php.
  2. single.php – WordPress then falls back to single.php.
  3. singular.php – Then it falls back to singular.php.
  4. index.php – Finally, as mentioned above, WordPress ultimately falls back to index.php.

The interactive diagram of the WordPress Hierarchy is a great resource for checking these kinds of things.