From 4418e79d0a8ee8a7d263d1107266e339cd9073c6 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 23 Nov 2020 19:29:30 -0300 Subject: [PATCH] Map all possible taxonomy templates --- includes/class-wc-template-loader.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-template-loader.php b/includes/class-wc-template-loader.php index 4ba345a8c90..5a3233756fa 100644 --- a/includes/class-wc-template-loader.php +++ b/includes/class-wc-template-loader.php @@ -155,6 +155,12 @@ class WC_Template_Loader { if ( is_product_taxonomy() ) { $object = get_queried_object(); + + $templates[] = 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; + $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; + $templates[] = 'taxonomy-' . $object->taxonomy . '.php'; + $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '.php'; + if ( is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) { $cs_taxonomy = str_replace( '_', '-', $object->taxonomy ); $cs_default = str_replace( '_', '-', $default_file ); @@ -163,11 +169,6 @@ class WC_Template_Loader { $templates[] = 'taxonomy-' . $object->taxonomy . '.php'; $templates[] = WC()->template_path() . 'taxonomy-' . $cs_taxonomy . '.php'; $templates[] = $cs_default; - } else { - $templates[] = 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; - $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '-' . $object->slug . '.php'; - $templates[] = 'taxonomy-' . $object->taxonomy . '.php'; - $templates[] = WC()->template_path() . 'taxonomy-' . $object->taxonomy . '.php'; } }