|
@@ -15,10 +15,17 @@
|
|
|
* @return void
|
|
|
*/
|
|
|
function lodestar_woocommerce_setup() {
|
|
|
- add_theme_support( 'woocommerce', array(
|
|
|
- 'thumbnail_image_width' => 830,
|
|
|
+ add_theme_support( 'woocommerce', apply_filters( 'lodestar_woocommerce_args', array(
|
|
|
'single_image_width' => 894,
|
|
|
- ) );
|
|
|
+ 'thumbnail_image_width' => 350,
|
|
|
+ 'product_grid' => array(
|
|
|
+ 'default_columns' => 3,
|
|
|
+ 'default_rows' => 4,
|
|
|
+ 'min_columns' => 1,
|
|
|
+ 'max_columns' => 6,
|
|
|
+ 'min_rows' => 1
|
|
|
+ )
|
|
|
+ ) ) );
|
|
|
add_theme_support( 'wc-product-gallery-zoom' );
|
|
|
add_theme_support( 'wc-product-gallery-lightbox' );
|
|
|
add_theme_support( 'wc-product-gallery-slider' );
|
|
@@ -71,7 +78,10 @@ function lodestar_woocommerce_products_per_page() {
|
|
|
return intval( apply_filters( 'lodestar_woocommerce_products_per_page', 12 ) );
|
|
|
}
|
|
|
|
|
|
-add_filter( 'loop_shop_per_page', 'lodestar_woocommerce_products_per_page' );
|
|
|
+// Legacy WooCommerce products per page filter.
|
|
|
+if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.3', '<' ) ) {
|
|
|
+ add_filter( 'loop_shop_per_page', 'lodestar_woocommerce_products_per_page' );
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
* Product gallery thumnbail columns
|
|
@@ -93,7 +103,10 @@ function lodestar_woocommerce_loop_columns() {
|
|
|
return intval( apply_filters( 'lodestar_woocommerce_loop_columns', 3 ) );
|
|
|
}
|
|
|
|
|
|
-add_filter( 'loop_shop_columns', 'lodestar_woocommerce_loop_columns' );
|
|
|
+// Legacy WooCommerce columns filter.
|
|
|
+if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.3', '<' ) ) {
|
|
|
+ add_filter( 'loop_shop_columns', 'lodestar_woocommerce_loop_columns' );
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
* Related Products Args
|
|
@@ -119,13 +132,29 @@ if ( ! function_exists( 'lodestar_woocommerce_product_columns_wrapper' ) ) {
|
|
|
* @return void
|
|
|
*/
|
|
|
function lodestar_woocommerce_product_columns_wrapper() {
|
|
|
- $columns = lodestar_woocommerce_loop_columns();
|
|
|
+ $columns = lodestar_loop_columns();
|
|
|
echo '<div class="columns-' . $columns . '">';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
add_action( 'woocommerce_before_shop_loop', 'lodestar_woocommerce_product_columns_wrapper', 40 );
|
|
|
|
|
|
+
|
|
|
+if ( ! function_exists( 'lodestar_loop_columns' ) ) {
|
|
|
+ /**
|
|
|
+ * Default loop columns on product archives
|
|
|
+ *
|
|
|
+ * @return integer products per row
|
|
|
+ */
|
|
|
+ function lodestar_loop_columns() {
|
|
|
+ $columns = 3; // 3 products per row
|
|
|
+ if ( function_exists( 'wc_get_default_products_per_row' ) ) {
|
|
|
+ $columns = wc_get_default_products_per_row();
|
|
|
+ }
|
|
|
+ return apply_filters( 'lodestar_loop_columns', $columns );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
if ( ! function_exists( 'lodestar_woocommerce_product_columns_wrapper_close' ) ) {
|
|
|
/**
|
|
|
* Product columns wrapper close
|