kimhf / sage-woocommerce-support
为基于 Sage 9 的主题添加 Woocommerce blade 模板和控制器的支持。
Requires
- php: >=7.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-27 03:17:21 UTC
README
为基于 Sage 9 的主题添加 Woocommerce blade 模板和控制器的支持。
安装
在主题目录内运行。
composer require kimhf/sage-woocommerce-support
需求
PHP 7.1 或更高版本
使用
示例:要覆盖模板 plugins/woocommerce/templates/single-product.php
,创建 themes/yoursagetheme/resources/views/single-product.blade.php
或 themes/yoursagetheme/resources/views/woocommerce/single-product.blade.php
示例:要覆盖部分 plugins/woocommerce/templates/content-product.php
,创建 themes/yoursagetheme/resources/views/partials/content-product.blade.php
或 themes/yoursagetheme/resources/views/woocommerce/content-product.blade.php
或 themes/yoursagetheme/resources/views/content-product.blade.php
详细信息
该软件包将在 Sage 配置中定义的路径中查找模板。它将同时搜索 .php 和 .blade.php 文件。
控制器数据和 woocommerce 的参数将始终添加到 blade 模板中,即使你在 php 和 blade 模板之间混合使用。
默认 Sage 和 WooCommerce 配置
从 resources/views/woocommerce
或 resources/views
加载模板层次结构中的模板作为入口模板。(在此情况下,WC_Template_Loader 仅加载空的 resources/index.php。)
wc_get_template()
默认配置将查找 resources/views/woocommerce
和 resources/views
。由 Woocommerce 添加的 $args 如果存在任何冲突,将优先于控制器数据。
wc_get_template_part()
默认配置将查找 resources/views/woocommerce
、resources/views/partials
和 resources/views
。
wc_get_template_html()
不受支持。