Home Forums WoodMart support forum Product Columns Category in Tablets

Product Columns Category in Tablets

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36749

    WebKonst
    Participant

    Hello there is attitude Products columns on mobile this is ok because I have 2 columns .. but on the tablets I want 3 columns! how can I do it?

    Thanks

    #36787

    Artem Temos
    Keymaster

    Hi,

    Try to add the following PHP code snippet to the child theme functions.php file to do this

    	function woodmart_get_grid_el_class($loop = 0, $columns = 4, $different_sizes = false, $xs_size = false, $sm_size = 4, $md_size = 3) {
    		$classes = '';
    
    		$items_wide = woodmart_get_wide_items_array( $different_sizes );
    
    		if( ! in_array( $columns, array(1,2,3,4,6,12) ) ) {
    			$columns = 4;
    		}
    
    		if( ! $xs_size ) {
    			$xs_size = apply_filters('woodmart_grid_xs_default', 6);
    		}
    
    		if( $columns <= 3 ) {
    			if( ! $xs_size ) $xs_size = 12;
    			if($columns == 1)
    				$sm_size = 12;
    			else
    				$sm_size = 4;
    		}		
    
    		$col = ' col-xs-' . $xs_size . ' col-sm-' . $sm_size . ' col-md-';
    
    		$md_size = 12/$columns;
    
    		// every third element make 2 times larger (for isotope grid)
    		if( $different_sizes && ( in_array( $loop, $items_wide ) ) ) { 
    			$md_size *= 2;
    		}
    
    		$classes .= $col . $md_size;
    
    		if($loop > 0) {
    			if ( 0 == ( $loop - 1 ) % $columns || 1 == $columns )
    				$classes .= ' first ';
    			if ( 0 == $loop % $columns )
    				$classes .= ' last ';
    		}
    
    		return $classes;
    	}

    Regards

Viewing 2 posts - 1 through 2 (of 2 total)