• Hi All,
    I would like to create custom category page templates.
    I have product tags such as ‘men’ ‘women’ and categories like ‘jackets’ ‘gloves.

    So if I would like to create a custom page for women’s jackets, What would the loop look like?

    I’ve been considering something like the following:
    Would this work or is there a more efficient way?

    <?php
    $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => -1, ‘product_cat’ => ‘jackets’, ‘product_tag’ => ‘women’ );

    $loop = new WP_Query( $args );

    while ( $loop->have_posts() ) : $loop->the_post();
    global $product;

    echo ‘<br />‘ . woocommerce_get_product_thumbnail().’ ‘.get_the_title().’‘;
    endwhile;

    wp_reset_query();
    ?>

    I’m not at work at the moment or I would just try it out but I’d like to know if I’m heading in the correct direction.

    Thanks for your help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘List products by category and product tag.’ is closed to new replies.