duanba7498 2015-05-10 13:03
浏览 27
已采纳

如何避免产品在WooCommerce中的分类限制?

Recently I'm faced with an interesting effect which seems to go with default settings.

When you just display products in mixed order it's ok, but when you're trying to create custom category for them - there are I'm getting the limit for loop: only 12 products are displayed in tab for category's list. E.g.:

there are 12 items of watches in "Men watches" tab:

here are 12 items of watches

but in fact, there are 16 of them:

enter image description here

Usually I add categories this way using standart form:

enter image description here

and add products to them:

enter image description here

In my functions.php file I added the line to extend the amount of products globally, but it didn't help:

enter image description here

Why the amount of rendered products by their categories is limited? Where to find the code that is in charge of this case?

  • 写回答

1条回答 默认 最新

  • doulu4976 2015-05-10 16:57
    关注

    There are two options you could give a try:

    1. If you are filtering by category, you are probably using the

    ["product_category"]

    where the default per_page attribute is set to be 12. You can override that by specifying the per_page="16".

    1. Try to set a priority to your add_filter function in the functions.php file, like

    add_filter("loop_shop_per page", create_function('$cols', 'return 16'), 20);

    Hope you get it to work.

    Greetings

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器