Thread Starter
AliaG
(@aliag)
Thanks for your reply Themelocation.
Unfortunately it seems to not work for me. I tried to add the code suggested in my functions.php file (first in my child theme file and then in the orginal theme file), but it give me a blank white page.
I also tried this code:
`// Change columns number
// ———————
add_filter( ‘loop_shop_columns’, ‘tm_product_columns’, 5);
function tm_product_columns($columns) {
if ( is_shop() || is_product_category() || is_product_tag() ) {
$columns = 3;
return $columns;
}
}`
but it didn’t work either.
Also tried these codes, but no luck. In both case, I can see the website, but nothing change in the number of products per row.
I’m using i-craft theme, but also trying other themes the problem persist.
Thread Starter
AliaG
(@aliag)
Looking around I also have found this piece of code in the file …/themes/i-craft/inc/woo-functions.php:
// Change number or products per row to 3
add_filter('loop_shop_columns', 'icraft_loop_columns');
if (!function_exists('icraft_loop_columns')) {
function icraft_loop_columns() {
global $icraft_data;
$woo_columns = 4;
if ( !empty($icraft_data['woo-archive-columns']) )
{
$woo_columns = $icraft_data['woo-archive-columns'];
}
return $woo_columns; // 3 products per row
}
}
// Display 12 products per page.
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ), 20 );
/**
* Change number of related products on product page
* Set your own value for 'posts_per_page'
*
*/
add_filter( 'woocommerce_output_related_products_args', 'icraft_related_products_args' );
function icraft_related_products_args( $args ) {
global $icraft_data;
$woo_columns = 4;
if ( !empty($icraft_data['woo-archive-columns']) )
{
$woo_columns = $icraft_data['woo-archive-columns'];
}
$args['posts_per_page'] = $woo_columns;
$args['posts_per_page'] = 10;
$args['columns'] = $woo_columns;
return $args;
}
So the thing should already be set, but it doesn’t work. Always only one product per row in my category page.
The same happens with the general Shop page: the categories are shown only 1 per row.
Any one have an idea? I also tried to ask the designer of the template, but he still haven’t answered.
The thing is that I have this visualization of 1 product per row, also using some other template…
Thank you in advance.
Are you sure there isn’t some CSS causing each product to break to a new line?
Thread Starter
AliaG
(@aliag)
I actually have no idea…it did it since the beginning, since before I created the child theme. Also because it does that bad joke, even with default theme like twenty Fourteen.
Where I could find some css that can cause the breaking of each product?
So far I “solved” using an old version of Woocommerce (2.3.11), instead of the last version.
Thank you in advance…
If its happening with Twenty Fourteen, its not CSS related, or theme related. Have you tried deactivating all plugins besides WooCommerce?
Thread Starter
AliaG
(@aliag)
I tried it (deactivated all plugin, but Woocommerce), but it didn’t help. The situation was the same: 1 product per row.
I’ll try to change to the newer version when I’ll upload everyting only, maybe that’s happening because my MAMP is not very much updated.