简体   繁体   English

WordPress-无法覆盖woocommerce模板

[英]WordPress - Failing to override woocommerce templates

I am trying to override Woocommerce's templates files by duplicating them in my custom theme directory / woocommerce / templates, but the changes don't appear (I tried simply adding classes to begin with) on the website. 我试图通过在我的自定义主题目录/ woocommerce /模板中复制Woocommerce的模板文件来覆盖它们,但是更改不会在网站上出现(我只是尝试添加类开头)。 Is there something I am doing wrong ? 我做错什么了吗?

Thank you for your concern. 谢谢你的关心。

While the directory structure in the WooCommerce plugin itself is: 虽然WooCommerce插件本身的目录结构是:

/plugins/woocommerce/templates/

You should define it like the following in your theme (note the missing templates dir): 您应该在主题中像下面这样定义它(注意缺少的templates目录):

/yourtheme/woocommerce/

In other words, you should put all of the overrides directly within the woocommerce/ directory (there will be no templates/ directory). 换句话说,您应该将所有替代直接放在woocommerce/目录中(不会有templates/目录)。 This is definitely confusing. 这绝对是令人困惑的。

make a Woocommerce folder inside the theme directory and then follow the folder structure symmetry as in the plugin for the fallback to work properly. 在主题目录中创建一个Woocommerce文件夹,然后按照插件中的文件夹结构对称性进行操作,以使后备正常工作。

Hope it will work 希望它能工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM