覆盖特定的第三方 Woocommerce 插件模板 [英] Overriding specific third party Woocommerce plugin templates
问题描述
我使用的是基于 Woocommerce 的插件,名为 Mix 'n Match Products.
这个插件位于 /plugins/woocommerce-mix-and-match-products/
此文件夹包含另一个模板文件夹.
按照惯例,我已将templates"文件夹复制到我的子主题中,并将文件夹名称更改为woocommerce-mix-and-match-products"
结构现在是themes/storevilla-child/woocommerce-mix-and-match-products/
但是,没有任何模板会覆盖插件模板.我已经测试过了.只有在我更改了实际的插件模板文件后,HTML 才会更改.
有人能发现我做错了什么吗?
谢谢
实现方式有点不同.所有 WooThemes woocommerce 插件都使用 本文档中描述的默认 woocommerce 模板文件夹:
2 种情况:
您的活动子主题(或主题)中已经有一个
woocommerce
文件夹.
复制自plugins/woocommerce-mix-and-match-products/templates/single-product/mnm/
themes/your_active_theme/woocommerce/single-product/
和plugins/woocommerce-mix-and-match-products/templates/single-product/add-to-cart/mnm.php
themes/your_active_theme/woocommerce/single-product/add-to-cart/
您的活动子主题(或主题)中没有任何
woocommerce
文件夹.
复制自plugins/woocommerce-mix-and-match-products/templates/
在您活动的子主题(或主题)中并将其重命名为woocommerce
.
<块引用>
因此,在您的情况下,您将拥有:themes/storevilla-child/woocommerce/
参考:WooCommerce 模板结构 + 通过主题覆盖模板
I'm using a Woocommerce based plugin called Mix 'n Match Products.
This plugin sits inside /plugins/woocommerce-mix-and-match-products/
This folder contains another folder for templates.
Following convention, I have copied the "templates" folder into my child theme and changed the folder name to "woocommerce-mix-and-match-products"
The structure is now themes/storevilla-child/woocommerce-mix-and-match-products/
However, none of the templates override the plugin templates. I have tested. Only once I change the actual plugin template files, does the HTML change.
Can anybody spot what I may be doing wrong?
Thanks
The way to do it is a little bit different. All WooThemes woocommerce plugins use the default woocommerce templates folder described in this documentation:
2 cases:
You have already a
woocommerce
folder in your active child theme (or theme).
Copy fromplugins/woocommerce-mix-and-match-products/templates/single-product/mnm/
tothemes/your_active_theme/woocommerce/single-product/
Andplugins/woocommerce-mix-and-match-products/templates/single-product/add-to-cart/mnm.php
insidethemes/your_active_theme/woocommerce/single-product/add-to-cart/
You don't have any
woocommerce
folder in your active child theme (or theme).
Copy fromplugins/woocommerce-mix-and-match-products/templates/
inside your active child theme (or theme) and rename itwoocommerce
.
So in your case you will have:
themes/storevilla-child/woocommerce/
Reference: WooCommerce Template Structure + Overriding Templates via a Theme
这篇关于覆盖特定的第三方 Woocommerce 插件模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!