Tagged: category page, column
-
AuthorPosts
-
February 27, 2020 at 1:18 pm #1188448
Hi,
is it possible to specify the number of columns and the product count only for certain product categories or pages?
thx in advance
maxFebruary 29, 2020 at 8:14 pm #1189056Hey maxisgoinghome,
If you build custom category pages you’ll be able to specify the columns count.
If you need further assistance please let us know.
Best regards,
VictoriaMarch 1, 2020 at 9:46 am #1189190This reply has been marked as private.March 4, 2020 at 3:17 am #1189878Hi,
Thank you for the update.
You can use this filter to change the number of products per row in the archive or shop page.
/** * Change number or products per row to 3 */ add_filter('loop_shop_columns', 'avf_loop_columns', 999); if (!function_exists('avf_loop_columns')) { function avf_loop_columns() { return 3; // 3 products per row } }Now, if you want to only apply the changes to a specific category, then you have to add conditions inside filter.
/** * Change number or products per row to 3 */ add_filter('loop_shop_columns', 'avf_loop_columns', 999, 1); if (!function_exists('avf_loop_columns')) { function avf_loop_columns($items) { if(is_tax('product_cat', 'category_name')) { $items = 3 ; // 3 products per row } return $items; } }Replace “category_name” with the actual name or slug of the product category.
Best regards,
IsmaelMarch 4, 2020 at 7:19 am #1189919Hi Ismael.
thx for the message. Where do I put this code? Quick CSS, function.php or anywhere else?
brg
maxMarch 5, 2020 at 8:35 am #1190319Hi,
You should add the snippet in the functions.php file. And don’t forget to adjust the category name. Let us know if it works.
Best regards,
IsmaelMarch 5, 2020 at 12:10 pm #1190395hi ismael,
thx that worked. problem is that the columns don’t get “resized”. I.e. if there is a standard of 5 columns and I decide to add the snippet with 3 columns there is a lot of white space on the right side ;))
thx. you can close the topic.
March 6, 2020 at 4:53 am #1190726 -
AuthorPosts
- The topic ‘Column and Product Count for Specific Category Pages’ is closed to new replies.
