更改商城列数
/**
* WooCommerce Extra Feature
* --------------------------
*
* Change product columns number on shop pages
*
*/
function woo_product_columns_frontend() {
global $woocommerce;
https:// Default Value also used for categories and sub_categories
$columns = 4;
https:// Product List
if ( is_product_category() ) :
$columns = 4;
endif;
https://Related Products
if ( is_product() ) :
$columns = 2;
endif;
https://Cross Sells
if ( is_checkout() ) :
$columns = 4;
endif;
return $columns;
}
add_filter('loop_shop_columns', 'woo_product_columns_frontend');
在哪里添加此代码?
将PHP代码放在主题或子主题functions.php文件的底部。