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


Robert James
Robert James
20,491 Points

WooCommerce and setting up different product pages

I am currently going through the E commerce with WordPress and Woo Commerce tutorials. I currently have a project where i have built a website for an artist. On the site there is a nav option for artwork which has a dropdown menu for 6 different areas of his artwork, eg. Landscapes, abstract, portraits etc...

I built this as a static HTML site to start and am currently developing that into a WordPress theme with the final object being able to sell the artwork through WooCommerce.

Basically i want like 6 pages with the template page-portfolio.php which will each be a page of thumbnails consisting of the artwork from each section. When one image is clicked it takes you to single-portfolio.php, but i also want this to be the single product page with the 'buy now' button.

Or would everything need to go through woocommerce and is it possible to have 6 "shop" pages?

Hope i have been clear in what im getting at?

Thanks in advance, Rob

1 Answer

Sue Dough
Sue Dough
35,800 Points

Hi Robert,

Woo Commerce has its own loops for displaying products so you will want to use that. You don't want to have to edit your code every time you add a new product. You will then want to create Woo Commerce categories for those specific 6 pages. Then you can easily assign products to categories.

Here is a sample woo commerce loop to show 10 products

<ul class="products">
        $args = array(
            'post_type' => 'product',
            'posts_per_page' => 10
        $loop = new WP_Query( $args );
        if ( $loop->have_posts() ) {
            while ( $loop->have_posts() ) : $loop->the_post();
                woocommerce_get_template_part( 'content', 'product' );
        } else {
            echo __( 'No products found' );

Take a look at some free Woo commerce themes to get a better understanding on the structure of them. Reverse engineer what you need to out of them.