久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 WooCommerce 更改每行的產品類別數

How to change the number of product categories per row using WooCommerce(如何使用 WooCommerce 更改每行的產品類別數)
本文介紹了如何使用 WooCommerce 更改每行的產品類別數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我使用 Woocommerce 設置在初始商店頁面上顯示類別縮略圖,然后在其中顯示產品及其縮略圖.

I'm using Woocommerce settings to show categories thumbnail on the initial shop page and then products and their thumbnails within them.

我希望初始類別頁面每行顯示 3 個縮略圖,產品頁面每行顯示 5 個類別.

I want to have that initial category page to display 3 thumbnails per row and the products page to show 5 categories per row.

每行顯示 5 個我使用過的產品:

To display 5 products per row I've used:

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
    return 5;
    }
}

這會更改類別頁面和商店頁面上每行的縮略圖.

This changes the thumbnails per row on the category page AND on the shop page too.

有誰知道如何將類別頁面更改為每行 3 個縮略圖并在商店頁面上保持每行 5 個產品?

Does anyone know how I can change the categories page to 3 thumbnails per row and maintain 5 products per row on shop page?

推薦答案

使用 WooCommerce 條件標簽,將幫助您實現這一目標.我已經更改了您的代碼:

Using WooCommerce conditionals tags, will help you to achieve that. I have changed your code:

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
    function loop_columns() {
        if ( is_product_category() ) {
            return 3;
        } else { // for other archive pages and shop page
            return 5;
        }
    }
}

此代碼位于活動子主題或主題的 function.php 文件中

建議:有時,需要更改一些 css 規則,以獲得每行的正確顯示.

Advice: Sometimes, is necessary to change some css rules, to get the correct display per row.

WooCommerce 條件標簽用法:

要定位商店頁面檔案:

if ( is_shop() ) {
    // return the number of items by row
}

要定位產品標簽檔案:

if ( is_product_tag() ) {
    // return the number of items by row
}

定位所有產品檔案,除了產品類別檔案(添加開頭):

if ( !is_product_category() ) {
    // return the number of items by row
}

您還可以定義一些特定的類別標簽(請參閱相關文檔).

And you can also define some particular categories or tags (see the documentation for that).

<小時>

參考文獻:


References:

  • WooCommerce - 更改每行的產品數量
  • WooCommerce - 條件標簽

這篇關于如何使用 WooCommerce 更改每行的產品類別數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 午夜免费电影 | 亚洲三级av | 国产精品美女久久久久久免费 | 一区二区三区四区不卡 | www.日韩| 国产在线播 | 国产伦精品一区二区三区精品视频 | 免费国产黄网站在线观看视频 | 操久久 | 日韩福利在线观看 | 涩涩片影院 | 色综合久久天天综合网 | 中文二区 | 亚洲在线一区二区三区 | 国产精品国产成人国产三级 | 99视频在线 | 1204国产成人精品视频 | 亚洲日本三级 | 2022精品国偷自产免费观看 | 国产日韩精品一区二区 | 国产精品亚洲综合 | 国产福利网站 | 一级免费视频 | 日韩精品一 | 黄色一级视频免费 | 人碰人操| 日本精品一区 | 一区二区免费 | 五月婷婷激情 | 日韩精品视频一区二区三区 | 亚洲人在线观看视频 | 免费一区 | 久久综合激情 | 奇米久久久 | 午夜精品导航 | 91久久国产综合久久 | 99精品欧美一区二区三区 | 欧美性一级 | 久久久久久国产 | 中文字幕日韩欧美 | 黄色精品 |