WooCommerce插件模板覆盖 [英] WooCommerce plugin template overriding

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

问题描述

我正在开发WooCommerce插件(实际上是常用的WP插件,但仅在启用WooCommerce时有效),该插件应更改标准的WooCommerce输出逻辑.特别是我需要自己重写标准的archive-product.php模板. 我发现在主题中更改模板没有问题,但是在插件中无法执行此操作.我该如何做到

WooCommerce核心?

解决方案

我认为您需要通过可用于WooCommerce的钩子(过滤器和操作)来完成此操作.

以下是列表: http://docs.woothemes.com/document/hooks/#templatehooks

这是开始使用钩子的地方: http://wp.tutsplus.com/教程/the-beginners-guide-to-wordpress-actions-and-filters/

I am developing a WooCommerce plugin (actually usual WP plugin, but works only when WooCommerce enabled), which should to change standard WooCommerce output logic. In particular I need to override standard archive-product.php template by my own. I have found there is no problem to change template in theme, but can not how to do it in the plugin. How I can do it without any changes in WP & WooCommerce cores?

解决方案

I think you need to do it via hooks (filters & actions) available for WooCommerce.

Here is a list: http://docs.woothemes.com/document/hooks/#templatehooks

Here is where to get started on hooks: http://wp.tutsplus.com/tutorials/the-beginners-guide-to-wordpress-actions-and-filters/

这篇关于WooCommerce插件模板覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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