[WordPress] 外掛分享: Genesis Connect for WooCommerce

首頁外掛目錄 › Genesis Connect for WooCommerce
WordPress 外掛 Genesis Connect for WooCommerce 的封面圖片
10,000+
安裝啟用
★★★★
4.1/5 分(17 則評價)
101 天前
最後更新
問題解決
WordPress 4.7+ PHP 5.6+ v1.1.2 上架:2012-02-28

內容簡介

此外掛替代了 WooCommerce 內建的商店模板,使用自己的 Genesis-ready 版本,更準確地說是 single-product.php、archive-product.php 和 taxonomy.php 模板,這些模板用於顯示單一產品頁面、主要商店頁面以及產品分類和產品標籤存檔頁面。

為了讓這些模板易於自定義,同時確保插件更新時不會失去自訂,您可以將自己的模板複製到子佈景主題的 'woocommerce' 資料夾中,並根據喜好進行自定義。您也可以在同一位置創建自己的 taxonomy-{taxonomy}.php 和 taxonomy-{taxonomy}-{term}.php 模板,此插件將查找並使用它們顯示商店的產品類別和產品標籤存檔。查閱 模板層級 以了解有關分類模板的命名要求的更多信息。

此外,此插件還使得 Genesis Simple Sidebars 和 Genesis Simple Menus 與 WooCommerce 兼容。

此版本與 WooCommerce 3.3+ 兼容。

對於技術方面比較熟悉的用戶,此插件所做的如下:

- 解除 WooCommerce 的模板加載器函數
- 添加自己的模板加載器函數來控制單一產品、存檔產品和產品類別以及產品標籤(分類)存檔頁面所使用的模板
- 將 Genesis 佈局和 SEO 支援添加到 WooCommerce 的自訂文章類型 'Product' 中
- 提供三個 Genesis-ready 模板來顯示商店頁面,位於插件的 'templates' 資料夾中:

single-product.php
archive-product.php
taxonomy.php

- 這些模板使用 WooCommerce 核心函數顯示商店循環,其中:

取消 WooCommerce 內建的麵包屑
取消 Genesis 循環,並替換為相關 WooCommerce 商店循環
移除不需要或不想使用的 Genesis 部分,即 WooCommerce 的 #container 和 #content divs

- 每個模板中的商店循環功能基於 WooCommerce,但已修改以容納某些 Genesis 功能,例如分類術語標題和描述功能。
- 這些模板包含 genesis(); 函數,因此可以透過 Genesis 鉤子和篩選器進行完全自定義。
- 模板加載器允許用戶在子佈景主題的 'woocommerce' 資料夾中使用自己的模板。如果這些用戶模板存在於子佈景主題的 'woocommerce' 資料夾中,則會在 Genesis Connect for WooCommerce 提供的模板位置加載這些自定義模板。
- 通過合適的篩選器,修改 Genesis 麵包屑輸出以模仿 WooCommerce 內建麵包屑的麵包屑結構。

預設情況下,Genesis 的麵包屑不提供與 WooCommerce 內建麵包屑相同的麵包屑結構。Genesis Connect for WooCommerce 在商店頁面上修改 Genesis 麵包屑輸出,以模仿 WooCommerce 內建麵包屑的麵包屑結構。需要注意的是,此插件提供的模板會自動取消 WooCommerce 的內建麵包屑,使用以下代碼在每個模板中:
remove_action( ‘woocommerce_before_main_content&

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Genesis Connect for WooCommerce」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plugin replaces WooCommerce’s built-in shop templates with its own Genesis-ready versions, specifically the single-product.php, archive-product.php and taxonomy.php templates needed to display the single product page, the main shop page, and Product Category and Product Tag archive pages.
To allow easy customization of these templates, and ensure that you do not lose your customizations when the plugin is updated, you can place your own copies of these templates in your child theme’s ‘woocommerce’ folder and customize these copies as much as you like. You can also create your own taxonomy-{taxonomy}.php and taxonomy-{taxonomy}-{term}.php templates in the same location and this plugin will find them and use them to display your shop’s Product Category and Product Tag archives. See the Template Hierarchy to learn more about naming requirements for taxonomy templates.
Additionally, the plugin makes Genesis Simple Sidebars and Genesis Simple Menus compatible with WooCommerce.
This version is compatible with WooCommerce 3.3+
Technical Info
For more technically minded users, this is what the plugin does:

Unhooks the WooCommerce template loader function
Adds its own template loader function to control the templates used by the single product, archive product and Product Category and Product Tag (taxonomy) archive pages.
Adds Genesis Layouts and SEO support to the WooCommerce Product custom post type
Provides three Genesis-ready templates to display the shop pages, located in the plugin’s templates folder:

single-product.php
archive-product.php
taxonomy.php

These templates use WooCommerce core functions to display the shop loops which:

unhook WooCommerce’s built-in breadcrumbs
unhook the Genesis Loop and replace it with the relevant WooCommerce shop loop
remove WooCommerce’s #container and #content divs, which are not required or wanted by Genesis

The shop loop function in each template is heavily based on its WooCommerce counterpart, but has been modified to accommodate certain Genesis features such as the Taxonomy term headings and descriptions feature.
The templates contain the genesis(); function and therefore are fully customisable using Genesis hooks and filters.
The template loader allows users to use their own templates in the child theme’s ‘woocommerce’ folder. These user templates, if they exist in the child theme’s `woocommerce’ folder, will be loaded in place of the supplied Genesis Connect for WooCommerce templates
Using appropriate filters, modifies the Genesis breadcrumbs output to mimic the breadcrumb structure provided by WooCommerce’s built-in breadcrumbs.

More about breadcrumbs
By default, the Genesis breadcrumbs do not provide the same breadcrumb structure as those built-in to WooCommerce. Genesis Connect for WooCommerce modifies the normal Genesis Breadcrumbs output on shop pages to mimic the structure of those built-in to WooCommerce.
Note that the templates provided in this plugin automatically unhook WooCommerce’s built-in breadcrumbs via this code in each template:
remove_action( ‘woocommerce_before_main_content’, ‘woocommerce_breadcrumb’, 20 );
Filters
This plugin provides some filters which may be useful for developers.
genesiswooc_custom_query

Located in gencwooc_single_product_loop() in templates/single-product.php.
The filter callback function should return a query object or false.
gencwooc_product_archive_crumb

Located in gencwooc_get_archive_crumb_filter() in lib/breadcrumb.php.
Allows further modification of the single product page breadcrumbs.
gencwooc_single_product_crumb

Located in gencwooc_get_single_crumb() in lib/breadcrumb.php.
Allows further modification of the product archive (shop page) breadcrumbs.
More info about WooCommerce CSS handling
For the benefit of theme developers and customizers, here is a summary of possible scenarios for dealing with WooCommerce CSS:

Case 1: If the WooCommerce > General settings > Enable WooCommerce CSS option is checked, the default stylesheet supplied with WooCommerce will be loaded (see wp-content/plugins/woocommerce/assets/css/woocommerce.css).
Case 2: If WooCommerce > General settings > Enable WooCommerce CSS option is unchecked, no stylesheet is loaded.
Case 3: If the user (or theme developer) sets define( 'WOOCOMMERCE_USE_CSS', true ); in the child theme functions.php the options setting is ignored and the default WooCommerce stylesheet is loaded, ie has same effect as checking the settings box.
Case 4: If the user (or theme developer) sets define( 'WOOCOMMERCE_USE_CSS', false ); in the child theme functions.php the options setting is ignored and NO stylesheet is loaded, ie has same effect as unchecking the settings box. Note: the value of WOOCOMMERCE_USE_CSS always takes precedence over the WooCommerce Settings page option!
If either Case 1 or Case 3 applies, if themes/my-child-theme/woocommerce/styles.css exists it will be loaded in place of the default woocommerce stylesheet (plugins/woocommerce/assets/css/woocommerce.css).
If either Case 2 or 4 applies, as no built-in stylesheet is loaded, all WooCommerce CSS styles need to be added to the theme’s main style.css stylesheet
Note for Genesis child theme developers: For new themes, theme developers can use define( 'WOOCOMMERCE_USE_CSS', false ); and place all WooCommerce styles in the theme’s main stylesheet, or do nothing and let the user handle this via Case 1 or 3.
The above information is based on WooCommerce 1.4.4

延伸相關外掛

文章
Filter
Apply Filters
Mastodon