wc_get_default_products_per_row()
Get the default columns setting – this is how many products will be shown per row in loops.
Description Description
Return Return
(int)
Source Source
File: includes/wc-template-functions.php
function wc_get_default_products_per_row() { $columns = get_option( 'woocommerce_catalog_columns', 4 ); $product_grid = wc_get_theme_support( 'product_grid' ); $min_columns = isset( $product_grid['min_columns'] ) ? absint( $product_grid['min_columns'] ) : 0; $max_columns = isset( $product_grid['max_columns'] ) ? absint( $product_grid['max_columns'] ) : 0; if ( $min_columns && $columns < $min_columns ) { $columns = $min_columns; update_option( 'woocommerce_catalog_columns', $columns ); } elseif ( $max_columns && $columns > $max_columns ) { $columns = $max_columns; update_option( 'woocommerce_catalog_columns', $columns ); } if ( has_filter( 'loop_shop_columns' ) ) { // Legacy filter handling. $columns = apply_filters( 'loop_shop_columns', $columns ); } $columns = absint( $columns ); return max( 1, $columns ); }
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |