我正在尝试定制WooCommerce的商店页面(在本例中称为“产品”),以包含来自我的WordPress主主题的模板部分。
get_template_part() 不起作用。我相信这是因为插件无法判断主题中会存在哪些文件,所以它被禁用了。或者,我想知道这是否是因为函数是从插件目录中调用的,所以它在错误的目录中查找。
include() 不起作用。我发现以下错误:
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in ...\\woocommerce\\archive-product.php on line 52
Warning: include(.../partials/acf-flexible-layout.php): failed to open stream: no suitable wrapper could be found in ...\\woocommerce\\archive-product.php on line 52
Warning: include(): Failed opening \'.../partials/acf-flexible-layout.php\' for inclusion (include_path=\'.;C:\\php\\pear\') in ...\\woocommerce\\archive-product.php on line 52
注:三个点(…)在文件路径中是对我的主题的引用。另外需要注意的是,我试图在模板部分包括与WordPress中的产品/商店页面相关联的引用高级自定义字段。
copying the template part\'s code directly into the archive-product.php 不起作用。我不知道为什么会这样。
任何帮助都将不胜感激。
<小时>EDIT我已经查过了How to include a file using get_template_part() in a plugin? 但这似乎并不合适:
所选答案给出include()
作为解决方案。我已经说过这对我不起作用I\'m 正在开发。这是WooCommerce。插件的任何更新都可能删除我添加/更改的文件the other promising answer 所以我无法调整它以满足我的需要(如果可能的话)