【发布时间】:2019-09-06 09:35:29
【问题描述】:
我想为产品图片和画廊缩略图使用我自己的自定义模板文件(带有自定义名称),因此需要使用以下方法覆盖默认的 Woocommerce 产品图片模板:
add_filter( 'wc_get_template', 'modify_product_gallery_template', 10, 5 );
function modify_product_gallery_template( $located, $template_name, $args, $template_path, $default_path ) {
if ( 'single-product/product-image.php' == $template_name ) {
$located = '... my-gallery.include.php';
}
return $located;
}
但是还没有成功。有没有其他方法可以做到这一点?
【问题讨论】:
标签: php wordpress templates woocommerce path