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

Sub Custom Post Types

I'm working on a project that requires me to use custom post types. But I have found that it's just not enough, I need another level so the site owner can add, edit at their own will so I'm not having to change content whenever they would like to alter or add a treatment to the site.

Basically I have one level being a treatment category i.e. Massage, but I need to then go one more level deep for each type of massage (hopefully that makes sense).

Is this possible with custom post types, or is there another approach that I can take? I have followed along with most of Zac Gordon videos and all of the example are only one level deep.

I would've post this on the WordPress.org forums, but I find most of the answers to come out of that site are difficult to understand, as I'm still getting my head around WordPress theme development.

I appreciate any advice on how I can go about this.

Stu :)

2 Answers

Hi Stu,

In my experience with WordPress, I've utilized ACF (Advanced Custom Fields) to give conditional input in my post types.

I think in your example you might be able to sub-categorize the Massages post type, and perhaps indicate more specific options using a true/false field.

Hope this makes sense, feel free to follow up if you'd like more clarification.

Andrey Ryazanov
Andrey Ryazanov
7,886 Points

Hello. I have the same problem as Stu. I need to build two level catalog and can't understand how to do it after viewing all the WP courses here :( The idea of John sounds good, I'll try it.