[Resolved] woocommerce category images / rows

Home Forums Support [Resolved] woocommerce category images / rows

Home Forums Support woocommerce category images / rows

Viewing 15 posts - 1 through 15 (of 45 total)
  • Author
    Posts
  • #1074151
    sparkle

    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?

    #1074178
    Leo
    Staff
    Customer Support

    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 πŸ™‚

    #1074519
    sparkle

    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

    #1075076
    sparkle

    ok… the site i linked is back up again. πŸ™‚

    #1075080
    Leo
    Staff
    Customer Support

    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;
    }
    #1075087
    sparkle

    sadly, this gives me the white screen of death

    #1075105
    Leo
    Staff
    Customer Support

    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?

    #1075129
    sparkle

    i’m just pasting it at the bottom of my child theme’s function file. https://www.loom.com/share/79496c7c67e64b7889bc922156a915eb

    #1075201
    Leo
    Staff
    Customer Support

    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?

    #1075219
    sparkle

    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. πŸ˜›

    #1075221
    sparkle

    oh, it’s 4 across everything… hmmm

    #1075231
    sparkle

    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 πŸ™

    #1075232
    sparkle

    https://imgur.com/a/Vk58xSQ are my plugins…. i don’t think any are meddling.

    #1075234
    Leo
    Staff
    Customer Support

    Can you guide me to the apparel category page?

    #1075238
    sparkle
Viewing 15 posts - 1 through 15 (of 45 total)
  • You must be logged in to reply to this topic.