Version Description
- 08/11/2016 =
- Tweak - Added a css fallback to hide elements in themes that use priorities that are different to WooCommerce core when hooking in related functions.
Download this release
Release Info
Developer | jameskoster |
Plugin | WooCommerce Product Archive Customiser |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- README.md +0 -4
- assets/css/layout.css +9 -0
- assets/css/layout.less +13 -1
- readme.txt +4 -1
- woocommerce-product-archive-customiser.php +56 -2
README.md
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
WooCommerce Product Archive Customiser
|
2 |
-
======================================
|
3 |
-
|
4 |
-
Allows you to customise WooCommerce product archives. Change the number of product columns and the number of products displayed per page. Toggle the display of core elements and enable some that are not included in WooCommerce core such as stock levels and product categories.
|
|
|
|
|
|
|
|
assets/css/layout.css
CHANGED
@@ -34,3 +34,12 @@
|
|
34 |
.woocommerce-page.product-columns-5 ul.products li.product.last {
|
35 |
margin-right: 0;
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
.woocommerce-page.product-columns-5 ul.products li.product.last {
|
35 |
margin-right: 0;
|
36 |
}
|
37 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-sale-flash .product .onsale,
|
38 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-product-count .woocommerce-result-count,
|
39 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-product-sorting .woocommerce-ordering,
|
40 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-add-to-cart .product .add_to_cart_button,
|
41 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-thumbnail .product .wp-post-image,
|
42 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-price .product .price,
|
43 |
+
.woocommerce.post-type-archive-product.wc-pac-hide-rating .product .star-rating {
|
44 |
+
display: none;
|
45 |
+
}
|
assets/css/layout.less
CHANGED
@@ -47,4 +47,16 @@
|
|
47 |
}
|
48 |
}
|
49 |
}
|
50 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
49 |
}
|
50 |
+
}
|
51 |
+
|
52 |
+
.woocommerce.post-type-archive-product {
|
53 |
+
&.wc-pac-hide-sale-flash .product .onsale,
|
54 |
+
&.wc-pac-hide-product-count .woocommerce-result-count,
|
55 |
+
&.wc-pac-hide-product-sorting .woocommerce-ordering,
|
56 |
+
&.wc-pac-hide-add-to-cart .product .add_to_cart_button,
|
57 |
+
&.wc-pac-hide-thumbnail .product .wp-post-image,
|
58 |
+
&.wc-pac-hide-price .product .price,
|
59 |
+
&.wc-pac-hide-rating .product .star-rating {
|
60 |
+
display: none;
|
61 |
+
}
|
62 |
+
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: jameskoster
|
|
3 |
Tags: woocommerce, ecommerce, products
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.6.1
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -49,6 +49,9 @@ function remove_pac_styles() {
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
52 |
= 1.0.3 - 13/10/2016 =
|
53 |
* Fix - Column layout
|
54 |
* Fix - Stock quantities of 1 are now displayed.
|
3 |
Tags: woocommerce, ecommerce, products
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 4.6.1
|
6 |
+
Stable tag: 1.0.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 1.0.4 - 08/11/2016 =
|
53 |
+
* Tweak - Added a css fallback to hide elements in themes that use priorities that are different to WooCommerce core when hooking in related functions.
|
54 |
+
|
55 |
= 1.0.3 - 13/10/2016 =
|
56 |
* Fix - Column layout
|
57 |
* Fix - Stock quantities of 1 are now displayed.
|
woocommerce-product-archive-customiser.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Product Archive Customiser
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-product-archive-customiser/
|
5 |
-
* Version: 1.0.
|
6 |
* Description: Allows you to customise WooCommerce product archives. Change the number of product columns and the number of products displayed per page. Toggle the display of core elements and enable some that are not included in WooCommerce core such as stock levels and product categories.
|
7 |
* Author: jameskoster
|
8 |
* Tested up to: 4.6.1
|
@@ -48,11 +48,12 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
48 |
* The constructor!
|
49 |
*/
|
50 |
public function __construct() {
|
51 |
-
$this->version = '1.0.
|
52 |
|
53 |
add_action( 'wp_enqueue_scripts', array( $this, 'wc_pac_styles' ) );
|
54 |
add_action( 'init', array( $this, 'wc_pac_setup' ) );
|
55 |
add_action( 'wp', array( $this, 'wc_pac_fire_customisations' ) );
|
|
|
56 |
add_action( 'wp', array( $this, 'wc_pac_columns' ) );
|
57 |
add_filter( 'loop_shop_per_page', array( $this, 'woocommerce_pac_products_per_page' ), 20 );
|
58 |
|
@@ -517,6 +518,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
517 |
* @return void
|
518 |
*/
|
519 |
function wc_pac_fire_customisations() {
|
|
|
520 |
// Sale flash.
|
521 |
if ( get_theme_mod( 'wc_pac_sale_flash', false ) === false ) {
|
522 |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
|
@@ -566,6 +568,58 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
566 |
if ( get_theme_mod( 'wc_pac_categories', false ) === true ) {
|
567 |
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_categories' ), 30 );
|
568 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
}
|
570 |
|
571 |
/**
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Product Archive Customiser
|
4 |
* Plugin URI: https://wordpress.org/plugins/woocommerce-product-archive-customiser/
|
5 |
+
* Version: 1.0.4
|
6 |
* Description: Allows you to customise WooCommerce product archives. Change the number of product columns and the number of products displayed per page. Toggle the display of core elements and enable some that are not included in WooCommerce core such as stock levels and product categories.
|
7 |
* Author: jameskoster
|
8 |
* Tested up to: 4.6.1
|
48 |
* The constructor!
|
49 |
*/
|
50 |
public function __construct() {
|
51 |
+
$this->version = '1.0.4';
|
52 |
|
53 |
add_action( 'wp_enqueue_scripts', array( $this, 'wc_pac_styles' ) );
|
54 |
add_action( 'init', array( $this, 'wc_pac_setup' ) );
|
55 |
add_action( 'wp', array( $this, 'wc_pac_fire_customisations' ) );
|
56 |
+
add_filter( 'body_class', array( $this, 'wc_pac_fire_customisation_styles' ) );
|
57 |
add_action( 'wp', array( $this, 'wc_pac_columns' ) );
|
58 |
add_filter( 'loop_shop_per_page', array( $this, 'woocommerce_pac_products_per_page' ), 20 );
|
59 |
|
518 |
* @return void
|
519 |
*/
|
520 |
function wc_pac_fire_customisations() {
|
521 |
+
|
522 |
// Sale flash.
|
523 |
if ( get_theme_mod( 'wc_pac_sale_flash', false ) === false ) {
|
524 |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
|
568 |
if ( get_theme_mod( 'wc_pac_categories', false ) === true ) {
|
569 |
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_categories' ), 30 );
|
570 |
}
|
571 |
+
|
572 |
+
}
|
573 |
+
|
574 |
+
/**
|
575 |
+
* Some plugins or themes may have already customized the hooks
|
576 |
+
* We'll add body classes to the page and hide elements with CSS as a fall back
|
577 |
+
*
|
578 |
+
* @return $body_classes
|
579 |
+
* @since 1.0.4
|
580 |
+
* @see https://github.com/jameskoster/woocommerce-product-archive-customiser/issues/22
|
581 |
+
*/
|
582 |
+
function wc_pac_fire_customisation_styles( $body_classes ) {
|
583 |
+
|
584 |
+
$wc_pac_body_classes = array();
|
585 |
+
|
586 |
+
// Sale flash.
|
587 |
+
if ( get_theme_mod( 'wc_pac_sale_flash', false ) === false ) {
|
588 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-sale-flash';
|
589 |
+
}
|
590 |
+
|
591 |
+
// Result Count.
|
592 |
+
if ( get_theme_mod( 'wc_pac_product_count', true ) === false ) {
|
593 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-product-count';
|
594 |
+
}
|
595 |
+
|
596 |
+
// Product Ordering.
|
597 |
+
if ( get_theme_mod( 'wc_pac_product_sorting', true ) === false ) {
|
598 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-product-sorting';
|
599 |
+
}
|
600 |
+
|
601 |
+
// Add to cart button.
|
602 |
+
if ( get_theme_mod( 'wc_pac_add_to_cart', true ) === false ) {
|
603 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-add-to-cart';
|
604 |
+
}
|
605 |
+
|
606 |
+
// Thumbnail.
|
607 |
+
if ( get_theme_mod( 'wc_pac_thumbnail', true ) === false ) {
|
608 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-thumbnail';
|
609 |
+
}
|
610 |
+
|
611 |
+
// Price.
|
612 |
+
if ( get_theme_mod( 'wc_pac_price', true ) === false ) {
|
613 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-price';
|
614 |
+
}
|
615 |
+
|
616 |
+
// Rating.
|
617 |
+
if ( get_theme_mod( 'wc_pac_rating', true ) === false ) {
|
618 |
+
$wc_pac_body_classes[] = 'wc-pac-hide-rating';
|
619 |
+
}
|
620 |
+
|
621 |
+
// Add the body classes to the body
|
622 |
+
return array_merge( $body_classes, $wc_pac_body_classes );
|
623 |
}
|
624 |
|
625 |
/**
|