Woocommerce 产品类别覆盖 [英] Woocommerce product-category overriding

查看:38
本文介绍了Woocommerce 产品类别覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a problem overriding standat Woocommerce template. I have a product category named "Parfyumeriya" on my website, so the link http://localhost/mywebsite/product-category/parfyumeriya/ shows the list of product in this category but it uses standart template. I want to use my own template, but I don't know which files of plugin's template should I edit. I tried content-product_cat.php, taxonomy-product_cat.php, archive-product.php, but nothing is working. Any ideas?

推荐答案

如果您要替换或覆盖的模板属于 woocommerce,您将在 wp-content/plugins/woocommerce/templates.

If the template you want to replace or override belongs to woocommerce you will find it in the wp-content/plugins/woocommerce/templates.

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

To override it you have to create a folder in your child-theme also named woocommerce and copy the file (whole path inside templates) there where you can edit it and make changes to it.

例如:

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

关于产品类别的特定模板,此问题所选答案中的评论说明如何命名文件:

Regarding having a specific template for a product category the comment in the selected answer of this question says how to name the file:

taxonomy-product_cat-{slug}.php

Woocommerce - 产品类别的特定模板?

这里有 woocommerce 文档的链接

这篇关于Woocommerce 产品类别覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆