Tagged: x
-
AuthorPosts
-
November 22, 2016 at 4:25 am #1266646
waiParticipantI was given this code earlier to change the number of columns display for this category archive:
add_filter('x_option_x_woocommerce_shop_columns', 'x_term_column'); function x_term_column ( $cols ) { if ( is_product_category() && get_queried_object()->term_id == 329 ) { return 4; } return $cols; }I also want to display 4 columns on my other category archives. Like here: https://www.mays.net.au/products/jewellery/pendant/
and
https://www.mays.net.au/products/jewellery/necklace/
But I have no idea how to modify this code.Please help!
November 22, 2016 at 4:41 am #1266652
Paul RModeratorHi,
Please update your code to this.
add_filter('x_option_x_woocommerce_shop_columns', 'x_term_column'); function x_term_column ( $cols ) { if ( is_product_category() && get_queried_object()->term_id == 329 && !is_product_category('pendant') && !is_product_category('necklace') ) { return 4; } return $cols; }Hope that helps.
November 22, 2016 at 4:57 am #1266664
waiParticipantI updated the code. It didn’t do anything.
November 22, 2016 at 4:57 am #1266665
waiParticipantThis reply has been marked as private.November 22, 2016 at 5:09 am #1266672
ChristopherModeratorHi there,
Please change number of Shop Columns under Customize -> Woocommerce.
Hope it helps.
November 22, 2016 at 5:30 am #1266677
waiParticipantI only want the sub-categories archives to have 4 columns not all. Please review the code above.
November 22, 2016 at 6:02 am #1266695
Paul RModeratorHi,
You need to set the default column in Shop Columns under Customize -> Woocommerce.
Then you can add the categories you wanted to have 4 columns in your filter code.
eg.
add_filter('x_option_x_woocommerce_shop_columns', 'x_term_column'); function x_term_column ( $cols ) { if ( is_product_category() && (get_queried_object()->term_id == 329 || get_queried_object()->term_id == 642 )) { return 4; } return $cols; }It will set these categories to 4 columns
https://www.mays.net.au/products/jewellery/
https://www.mays.net.au/products/gemstones/Hope that helps.
November 22, 2016 at 6:18 am #1266706
waiParticipantThat code did the job, thanks! 🙂
November 22, 2016 at 6:34 am #1266719
DarshanaModeratorGlad we were able to help 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1266646 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
