Woocommerce产品类别压倒一切

时间:2017-11-06 14:07:42

标签: php html wordpress woocommerce

我有一个问题,就是重写标准的Woocommerce模板。我的网站上有一个名为“Parfyumeriya”的产品类别,因此链接http://localhost/mywebsite/product-category/parfyumeriya/显示此类别中的产品列表,但它使用标准模板。我想使用自己的模板,但我不知道应该编辑插件模板的哪些文件。我尝试了content-product_cat.php,taxonomy-product_cat.php,archive-product.php,但没有任何工作。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

如果您要替换或覆盖的模板属于woocommerce,您可以在 wp-content / plugins / woocommerce / templates 中找到它。

要覆盖它,您必须在子主题中创建一个名为 woocommerce 的文件夹,然后将文件(模板内的整个路径)复制到那里,您可以在其中对其进行编辑并对其进行更改。 / p>

例如:

plugins / woocommerce / templates / taxonomy-product_cat.php 将被复制为 themes / your_child_theme / woocommerce / taxonomy-product_cat.php

关于为产品类别设置特定模板,此问题的选定答案中的注释说明如何命名文件:

taxonomy-product_cat-{slug}.php

Woocommerce - Specific template for product category?

Here there is a link to woocommerce docs