template_path() . $file; } elseif ( is_product_taxonomy() ) { $term = get_queried_object(); if ( is_tax( 'product_cat' ) || is_tax( 'product_tag' ) ) { $file = 'taxonomy-' . $term->taxonomy . '.php'; } else { $file = 'archive-product.php'; } $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php'; $find[] = 'taxonomy-' . $term->taxonomy . '.php'; $find[] = WC()->template_path() . 'taxonomy-' . $term->taxonomy . '.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } elseif ( is_post_type_archive( 'product' ) || is_page( wc_get_page_id( 'shop' ) ) ) { $file = 'archive-product.php'; $find[] = $file; $find[] = WC()->template_path() . $file; } if ( $file ) { $template = locate_template( array_unique( $find ) ); $status_options = get_option( 'woocommerce_status_options', array() ); if ( ! $template || ( ! empty( $status_options['template_debug_mode'] ) && current_user_can( 'manage_options' ) ) ) { $template = WC()->plugin_path() . '/templates/' . $file; } } return $template; } /** * comments_template_loader function. * * @param mixed $template * @return string */ public static function comments_template_loader( $template ) { if ( get_post_type() !== 'product' ) return $template; if ( file_exists( get_stylesheet_directory() . '/' . WC()->template_path() . 'single-product-reviews.php' )) return get_stylesheet_directory() . '/' . WC()->template_path() . 'single-product-reviews.php'; elseif ( file_exists( get_template_directory() . '/' . WC()->template_path() . 'single-product-reviews.php' )) return get_template_directory() . '/' . WC()->template_path() . 'single-product-reviews.php'; elseif ( file_exists( get_stylesheet_directory() . '/' . 'single-product-reviews.php' )) return get_stylesheet_directory() . '/' . 'single-product-reviews.php'; elseif ( file_exists( get_template_directory() . '/' . 'single-product-reviews.php' )) return get_template_directory() . '/' . 'single-product-reviews.php'; else return WC()->plugin_path() . '/templates/single-product-reviews.php'; } } WC_Template_Loader::init();