Site logo

Archived topic

woocommerce category images / rows

44 replies · Started by sparkle on November 23, 2019

Viewing posts 1–15 of 45

i'm trying to accomplish the same thing this person was doing, but it's not working.

https://generatepress.com/forums/topic/controlling-woocommerce-products-per-row-on-certain-category-pages/

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

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 :(

Can you guide me to the apparel category page?

This archived topic is closed to new replies.