在woocommerce中更改存档页面中的列数 [英] Changing the number of columns in archive pages in woocommerce

查看:100
本文介绍了在woocommerce中更改存档页面中的列数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在woocommerce中更改存档页面中的列数?

How can I change the number of columns in archive pages in woocommerce?

它在商店页面中显示3个,在归档页面中显示4个.

It shows 3 in shop pages, but 4 in archive pages.

谢谢

推荐答案

此代码段代码将更改所有存档页面上每页的产品数:

This snippet code will change the number of products per page on all archives pages:

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

此代码将放在您的活动子主题或主题的function.php文件上

建议:有时,有必要更改某些CSS规则,以使每行显示正确.

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

如果要定位某些特定的存档页面,则可以使用 if/else语句中的> WooCommerce条件标签

If you want to target some specific archive pages you can use WooCommerce conditionals tags in an if/else statement as in this thread


参考:

  • Change number of products per row
  • WooCommerce conditionals tags
  • WooCommerce - Changing the number of product categories per row

这篇关于在woocommerce中更改存档页面中的列数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆