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 The WordPress Template Hierarchy Archive Templates in WordPress The WordPress Archive Templates Quiz

tarry nwaise
tarry nwaise
1,391 Points

Appending a category slug or id to the main category template

Why is it possible to append the category slug or id to the main category template, (category.php); however, you cannot append the slug or id to a single post (post.php). However, you can append the slug or id to a page (page.php)?

Is that correct and if so why?

1 Answer

I can't tell you exactly why you can't do this as i don't know. WordPress just doesn't allow it.

This image shows the Template Hierarchy and all the possibilities for template hierarchies.

However the code in this answer could be modified to allow what you want to do i suspect.