Archived topic
woocommerce category images / rows
44 replies · Started by sparkle on November 23, 2019
i'm trying to accomplish the same thing this person was doing, but it's not working.
the category i want to change to is apparel.
add_filter( 'option_generate_woocommerce_settings', 'tu_custom_wc_columns' );
function tu_custom_wc_columns( $options ) {
if ( ! is_product_category( 'apparel' ) ) {
$options['columns'] = 6;
}
return $options;
}
is this no longer the right way to do this?
Hi there,
That should still work.
Just to make sure, the current conditional tag is setting everything to 6 columns Except for apparel category.
Is that what you are after?
Let me know :)
hmm. i want to show the apparel subcategory icons 6 across and everything else 3. i also just deleted my entire apparel section accidentally, but.... that's my problem, not yours. ;D
ok... the site i linked is back up again. :)
I want to show the apparel subcategory icons 6 across and everything else 3.
So your customizer option should be 3 and this should be your code:
add_filter( 'option_generate_woocommerce_settings', 'tu_custom_wc_columns' );
function tu_custom_wc_columns( $options ) {
if ( is_product_category( 'apparel' ) ) {
$options['columns'] = 6;
}
return $options;
}
sadly, this gives me the white screen of death
Just tried the code without issues:
https://www.screencast.com/t/cy73PNaQMdqQ
How are you adding it?
Can you make sure the previous snippet is removed?
i'm just pasting it at the bottom of my child theme's function file. https://www.loom.com/share/79496c7c67e64b7889bc922156a915eb
Hmm perhaps the error is coming from another snippet in your child theme?
What happens if you remove other functions temporarily and only keep this one?
ok. weird. doing that gets me 4 across.
now i have to go back into my functions file and add them back in one by one, eh? like a plugin dance, but functions. fun. fun. :P
oh, it's 4 across everything... hmmm
ok. found... it, but i changed 4 to 3 in the customizer and put only your code in the functions file and i still get 3 across everything including the category images :(
https://imgur.com/a/Vk58xSQ are my plugins.... i don't think any are meddling.
Can you guide me to the apparel category page?