
內容簡介
包含在 WooCommerce 的簡寫程式碼無法按照自訂分類法型態篩選產品並在文章或頁面中顯示。
舉例來說,假設我們擁有一個名為「Vendors」的產品自訂分類法型態,分類標籤元素包括 Apple、Samsung、LG、Motorola、Microsoft 等。如果我們想要在一頁或一篇文章中只顯示 Apple 的產品,就可以使用這個奇特的外掛程式。
使用方式
[woo_products_custom_tax tax_name="vendor" tax_tags="apple" columns="4" template="product" qty="10" order="DESC"]
屬性
tax_name(字串)(必需):自訂分類法型態的別名。
tax_tags(字串)(必需):自訂分類標籤的別名。也可以填入多個標籤,用逗號(,)隔開(例如,tax_tags=”apple,samsung”)。
columns(整數)(選擇性,預設值為4):每行顯示的產品或欄位數。
template(字串)(選擇性,預設值為「product」):指定 WooCommerce 的模板檔案來顯示產品。例如,您可以使用您自己的客製化模板檔案代替原本的 /wp-content/plugins/woocommerce/templates/content-product.php 檔案,便可載入該模板(例如,template=”my-custom-product-file”)。
qty(整數)(選擇性,預設值為10):每頁或輸出顯示的產品最大數量。
order(字串)(選擇性,預設值為‘DESC’):輸出頁面中所顯示的產品順序。‘ASC’ 為由小到大順序,‘DESC’ 為由大到小順序。
分頁
若要加入分頁支援,請安裝 WooCommerce 的簡寫程式碼分頁外掛程式。
如有任何修復、新增功能、強化建議,歡迎透過 GitHub 進行 Pull requests 。
外掛標籤
開發者團隊
② 後台搜尋「Woocommerce – Products By Custom Tax」→ 直接安裝(推薦)
原文外掛簡介
Shortcodes included with WooCommerce lacks on the possibility to display products in post or pages filtering them by a custom taxonomy type.
For example in the scenario where we have a custom taxonomy type for products which is called Vendors and this one contains Apple, Samsung, LG, Motorola, Microsoft, … as taxonomy tags elements. If we like to display only the products by Apple in a page or post, here this odd tweak plugin comes to the rescue.
Usage
[woo_products_custom_tax tax_name="vendor" tax_tags="apple" columns="4" template="product" qty="10" order="DESC"]
Attributes
tax_name (string) (required): The custom taxonomy slug.
tax_tags (string) (required): The custom taxonomy tags slug. Accepts also multiple tags as an array separated by comma (tax_tags=”apple,samsung”).
columns (integer) (optional, default = 4): The ammount of products/colums to display per row.
template (string) (optional, default = “product”): Specifies the WooCommerce template file to use for displaying products. e.g. Instead of loading the default file /wp-content/plugins/woocommerce/templates/content-product.php you might want to use your custom template override file /wp-content/themes/twentyfifteen/woocommerce/content-my-custom-product-file.php. For this case you can load the template like (template=”my-custom-product-file”).
qty (integer) (optional, default = 10): The max ammount of products to display per page/output.
order (string) (optional, default = ‘DESC’): The order of products to display per page/output. ‘ASC’ – ascending order from lowest to highest values. ‘DESC’ – descending order from highest to lowest values.
Pagination
For pagination support please install Shortcode Pagination for WooCommerce.
Pull requests for fixes, new features and enhancements are welcome on GitHub 😉
