【发布时间】:2020-11-05 20:45:47
【问题描述】:
我创建了一个与店面一起工作的子主题,并且正在努力自定义各个产品页面的布局。
在 single-product.php 下,我希望看到可以操作的 html 标记,但实际上声明的是这样的:
wc_get_template_part( 'content', 'single-product' );
无法访问实际代码……
同样,对于我的搜索栏,我需要将代码添加到单个产品搜索结果中。但在 search.php 中声明了以下内容:
get_template_part( 'loop' );
再次,强迫我尽可能使用 JS 和 CSS 来操纵外观。
【问题讨论】:
-
首先阅读Override WooCommerce templates via the theme ...然后您需要编辑
content-single-product.php相关模板文件或通过可用钩子更改查询参数...因为get_template_part( 'loop' );与Wordpress Loop模板相关...
标签: wordpress templates woocommerce wordpress-theming storefront