Generally, you can tell WordPress to load a different template. The mostly seen approaches make either use of the template_redirect
or the template_include
hook. It is preferable to use template_include
as described in this article. Following an example on how to approach this:
Code:
// load the woocommerce category archive template
add_filter( 'template_include', 'wpse138858_woocommerce_category_archive_template' );
function wpse138858_woocommerce_category_archive_template( $original_template ) {
// we're loading the template conditionally,
// but only if we're actually on a woocommerce category archive
if ( is_product_category() ) {
// you've to create the template you want to use here first
return get_template_directory().'/woocommerce-category-archive.php';
} else {
return $original_template;
}
}
Additional information:
Notes:
- untested
- There might be a more specific way to do this for/with woocommerce, depending on how they handle there template loading. For that you have to extend your research and/or dive into the woocommerce code.
Edit:
What you are looking for – if you want to do it the woocommerce way – is the function wc_get_template_part()
– formerly, pre WC 2.1, woocommerce_get_template_part()
, now deprecated. I’ve given an answer on how to use the latter some time ago, you can do it for the newly named – the functionality is the same – function accordingly. The answer of course regards the direct use of the function, in your case you probably want and should make use of the correspondent hook wc_get_template_part
. With this information on hand you should be able to do this the woocommerce way.