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!

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


HELP! Struggling With a Multi Level Category Archive

Hello everyone :)

I'm currently building a site for a local beauty salon and I have come across an issue that I just cannot seem to put my finger on and I have been stuck on this for weeks, where I'm stuck is with the treatments page.

The project requires that I have a treatments page that lists all available treatment categories (massage, waxing, nails, etc). When a user clicks on the treatment category they're after they are then taken to another page that lists all the treatments within that category i.e., Waxing -> Full Leg Wax.

I did a Google search to try and find a good example of what I'm after and I came up with this example and it is exactly what I'm after.


  • List of Treatment Categories (Waxing, Nails, Massage, etc)
    • Individual Treatments (Back Massage, Leg Wax, Eyebrow Tint, etc)
      • Individual Treatment Details (Price, Duration, Description)

I have used a custom post type for the individual treatments, named 'treatments', and then I created a taxonomy called ‘treatment-categories’ (I’ve used the slug names of each). I have used my archive.php template and obviously I have named this archive-treatments.php (code below). I will look at altering the layout of the template once I have this figured out.

<?php get_header(); ?>

<section class="hero hero-sml hero-default no-marg-bottom">
   <div class="container clearfix">
            the_archive_title( '<h1>', '</h1>' );
   </div><!-- .container -->
</section><!-- .hero -->

<div class="muted-bg">
   <section class="margin-top container clearfix">
      <div class="row">

         <?php if( have_posts() ) : while( have_posts() ) : the_post(); ?>

            <div class="col-4 post-excerpt">

                  <a href="<?php the_permalink(); ?>">
                        // Display the featured image
                        if( the_post_thumbnail() ) :
                           the_post_thumbnail( 'small' );

                  <time class="post-date">
                     <?php the_date(); ?>

                     <a href="<?php the_permalink(); ?>">
                        <?php the_title(); ?>

                     <?php the_excerpt(); ?>

            </div><!-- .post-excerpt -->

         <?php endwhile; endif; ?>

      </div><!-- .row -->
   </section><!-- .container -->
</div><!-- .muted-bg -->

<?php get_footer(); ?>

I have done the same for the treatment-categories taxonomy (archive-treatment-categories), is this the correct way of doing this? Is WordPress even capable of doing something like this? Also just to clarify in case this maybe an issue, I have a blog that utilises categories, tags, etc and a WooCommerce store if that helps.

I really appreciate any help with this, and I'm sure it's one of those solutions where I'll be saying "really, is that all I had to do?". I have been trying this for way too long and it doesn't make any sense anymore to me, I just need another opinion on how to do this.

Thanking you all in advance

Stu :)