• Hi,
    I’m customizing the number of product per row in one of my archive page – on category “A”.
    I put the code on my functions.php but the snippet have no effect on layout.
    I imagine that I should override Astra CSS – can anyone help with it?
    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @loregi13,

    Could you please share the code?

    ?For more convenience, you may need to consider using a plugin to do that, e.g. Elementor.?

    ??Kind regards,
    ?Herman ??

    ??P.S. We recommend reaching out to us through our Support Portal for faster and quicker help and resolution as mentioned here.

    Thread Starter LoreGI13

    (@loregi13)

    Hi, I share the code I put in my funcions.php.
    As regards Elementor, I’d like to avoid as I’m trying to put the minimum coding

    This is the code:
    /* Set product columns for specific category solidcolor */

    add_filter(‘loop_shop_columns’, ‘loop_columns’);
    if (!function_exists(‘loop_columns’)) {
    function loop_columns() {
    if ( is_product_category(‘solidcolor’)) {
    return 6;
    }else{
    return 4;
    }
    }
    }

    Hi @loregi13,
    ?
    Would you please try adding this custom PHP code to your site

    add_action('wp', 'column_call_back' , 1);
    function column_call_back(){
        if(is_product_category() ){
            $terms = wp_get_post_terms( get_the_id(), 'product_cat' );
            var_dump($term->name);
            // Check that there is at least one product category set for the product
            if( sizeof($terms) > 0 ){
                // Get the first product category WP_Term object
                $term = end($terms);
                if ("Category Name" === $term->name){ 
                    //custom column numbers for category archive page.
                    add_filter('astra_get_option_shop-grids', 'category_column');
                }
        }
    }
    }
    function category_column( $col ){
            $col['desktop'] = "6";
            $col['tablet'] = "4";
            $col['mobile'] = "2";
        return $col;
    }

    ???Change the “Category Name” to your actual category name.

    Please let us know how you go.

    ???Kind regards,
    ?Herman ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘customizing the number of product per row – how to override the Astra setting’ is closed to new replies.