bluvertigo
2/17/2015 - 11:48 AM

Changing the number of product columns / Numero colonne prodotti

Changing the number of product columns / Numero colonne prodotti

<?php

add_filter( 'loop_shop_columns', 'wc_loop_shop_columns', 1, 10 );

/*
 * Return a new number of maximum columns for shop archives
 * @param int Original value
 * @return int New number of columns
 */
function wc_loop_shop_columns( $number_columns ) {
	return 2;
}
<?php
/* Alternativa che varia in base alla pagina*/

add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')); {
function loop_columns() {
if (is_shop()){
return 2; // 2 products per row
}elseif(is_product_category()){
return 4; // 4 products per row
}
}
}