Astra_Woocommerce::get_grid_column_count( string $type = 'archive', string $device = 'desktop', int $default = 2 )
Get grid columns for either Archive|Single product.
Description
Introducing this function to reduce lot of CSS we write for ‘grid-template-columns’ for every count (till 6).
Parameters
- $type
-
(string) (Optional) - WooCommerce page type Archive/Single.
Default value: 'archive'
- $device
-
(string) (Optional) - Device specific grid option.
Default value: 'desktop'
- $default
-
(int) (Optional) - Default grid count (fallback basically).
Default value: 2
Return
(int) grid count.
Source
File: inc/compatibility/woocommerce/class-astra-woocommerce.php
public function get_grid_column_count( $type = 'archive', $device = 'desktop', $default = 2 ) { if ( 'archive' === $type ) { $products_grid = astra_get_option( 'shop-grids' ); } else { $products_grid = astra_get_option( 'single-product-related-upsell-grid' ); } return isset( $products_grid[ $device ] ) ? absint( $products_grid[ $device ] ) : $default; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
3.4.3 | Introduced. |