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

Mateusz Grzybowski
Mateusz Grzybowski
2,216 Points

Implement a multiple step query

I'm wondering if I could display a post by 4 steps by this schema:

Cars > Parts > Windows > Single Window On each step (except the last one), I have an image grid, title, and a link to the next step.

I don't know how to implement this. If I had only 2 steps, I would manage this as blog post.

I'm not making a shop (this is the only example) so WooCommerce would not be a good solution.

Maybe creating a custom post type with custom fields and taxonomies would help with creating the query?

Evan Agee
Evan Agee
13,088 Points

I'll take a stab at this and hopefully it'll get you rolling.

The multi-step filtering you're talking about would be accomplished using the Category/taxonomy, not with a custom post type (although you might be able to pull it off).

For your example I would either use the existing Category taxonomy or create a new custom taxonomy. You would want it to be hierarchical and then create your categories.

Cars
- Parts
-- Window
--- Single Window

Then for each product/post you would assign it to the correct category. Each category template will by default list all posts that are associated with it, so you would then just have to add a widget to the category template that lists all categories that are a child/ancestor of the current category.

This should give you the functionality you're looking for.