【问题标题】:override woocommerce.php with custom content for only store homepage使用仅商店主页的自定义内容覆盖 woocommerce.php
【发布时间】:2018-02-20 07:51:14
【问题描述】:

我目前使用 FoundationPress (Foundation6) 作为框架和入门主题。它使用 woocommerce.php 模板文件来挂钩 woocommerce 功能,但对于我来说,我无法弄清楚。

我只需要将自定义内容添加到商店主页,而不是其他商店页面。我添加到 woocommerce.php 中的任何内容都会出现在所有商店页面上,但我无法确定控制商店主页的模板。

我可以看到使用的第一组模板是循环文件夹和 content-product.php 中的模板。通常我只会编辑 archive-product.php 但 woocommerce.php 会从这个模板中接管:见底部https://docs.woocommerce.com/document/template-structure/

【问题讨论】:

    标签: wordpress woocommerce zurb-foundation


    【解决方案1】:

    商店是存档产品。但是我没有尝试 FundationPress,但似乎 WooCommerce 需要在最新版本中声明主题中的 WooCommerce 支持。 https://github.com/woocommerce/woocommerce/wiki/Declaring-WooCommerce-support-in-themes

    所以首先尝试https://en-gb.wordpress.org/plugins/query-monitor/ 并检查正在加载的模板。如果它的加载 page.php 而不是 Woocommerce 模板实现 functions.php 中的行。

    【讨论】:

    • 我的主题已经包含了主题支持,遗憾的是,查询监视器没有提供比我更多的信息(虽然有用的插件)。我可以删除 woocommerce.php,它默认恢复为 archive-product.php - 但看看 woocommerce.php 如何/使用什么来构建页面会很有用。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-19
    • 2013-09-07
    • 1970-01-01
    • 2019-07-31
    • 2015-04-13
    相关资源
    最近更新 更多