Version Description
- 06/10/2016 =
- Fix - Specify a default for Customizer settings.
- Fix - More explicit css for column layout.
Download this release
Release Info
Developer | jameskoster |
Plugin | WooCommerce Product Archive Customiser |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- assets/css/layout.css +20 -1
- assets/css/layout.less +11 -0
- readme.txt +6 -2
- woocommerce-product-archive-customiser.php +17 -17
assets/css/layout.css
CHANGED
@@ -1 +1,20 @@
|
|
1 |
-
.woocommerce.product-columns-2 ul.products li.product
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.woocommerce.product-columns-2 ul.products li.product,
|
2 |
+
.woocommerce-page.product-columns-2 ul.products li.product {
|
3 |
+
width: 48%;
|
4 |
+
margin-right: 3.8%;
|
5 |
+
}
|
6 |
+
.woocommerce.product-columns-3 ul.products li.product,
|
7 |
+
.woocommerce-page.product-columns-3 ul.products li.product {
|
8 |
+
width: 30.75%;
|
9 |
+
margin-right: 3.8%;
|
10 |
+
}
|
11 |
+
.woocommerce.product-columns-4 ul.products li.product,
|
12 |
+
.woocommerce-page.product-columns-4 ul.products li.product {
|
13 |
+
width: 22.05%;
|
14 |
+
margin-right: 3.8%;
|
15 |
+
}
|
16 |
+
.woocommerce.product-columns-5 ul.products li.product,
|
17 |
+
.woocommerce-page.product-columns-5 ul.products li.product {
|
18 |
+
width: 16.9%;
|
19 |
+
margin-right: 3.8%;
|
20 |
+
}
|
assets/css/layout.less
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
ul.products {
|
4 |
li.product {
|
5 |
width:48%;
|
|
|
6 |
}
|
7 |
}
|
8 |
}
|
@@ -10,6 +11,15 @@
|
|
10 |
ul.products {
|
11 |
li.product {
|
12 |
width:30.75%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
}
|
15 |
}
|
@@ -17,6 +27,7 @@
|
|
17 |
ul.products {
|
18 |
li.product {
|
19 |
width:16.9%;
|
|
|
20 |
}
|
21 |
}
|
22 |
}
|
3 |
ul.products {
|
4 |
li.product {
|
5 |
width:48%;
|
6 |
+
margin-right: 3.8%;
|
7 |
}
|
8 |
}
|
9 |
}
|
11 |
ul.products {
|
12 |
li.product {
|
13 |
width:30.75%;
|
14 |
+
margin-right: 3.8%;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
18 |
+
&.product-columns-4 {
|
19 |
+
ul.products {
|
20 |
+
li.product {
|
21 |
+
width:22.05%;
|
22 |
+
margin-right: 3.8%;
|
23 |
}
|
24 |
}
|
25 |
}
|
27 |
ul.products {
|
28 |
li.product {
|
29 |
width:16.9%;
|
30 |
+
margin-right: 3.8%;
|
31 |
}
|
32 |
}
|
33 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: jameskoster
|
3 |
Tags: woocommerce, ecommerce, products
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 4.
|
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,10 @@ function remove_pac_styles() {
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= 1.0.1 - 29/04/2016 =
|
53 |
* Fix - Products per page setting.
|
54 |
|
2 |
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.2
|
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.2 - 06/10/2016 =
|
53 |
+
* Fix - Specify a default for Customizer settings.
|
54 |
+
* Fix - More explicit css for column layout.
|
55 |
+
|
56 |
= 1.0.1 - 29/04/2016 =
|
57 |
* Fix - Products per page setting.
|
58 |
|
woocommerce-product-archive-customiser.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Product Archive Customiser
|
4 |
-
* Plugin URI:
|
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.
|
9 |
* Author URI: http://jameskoster.co.uk
|
10 |
* Text Domain: woocommerce-product-archive-customiser
|
11 |
* Domain Path: /languages/
|
@@ -518,52 +518,52 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
518 |
*/
|
519 |
function wc_pac_fire_customisations() {
|
520 |
// Sale flash.
|
521 |
-
if ( get_theme_mod( 'wc_pac_sale_flash' ) === false ) {
|
522 |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
|
523 |
}
|
524 |
|
525 |
// Result Count.
|
526 |
-
if ( get_theme_mod( 'wc_pac_product_count' ) === false ) {
|
527 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
|
528 |
}
|
529 |
|
530 |
// Product Ordering.
|
531 |
-
if ( get_theme_mod( 'wc_pac_product_sorting' ) === false ) {
|
532 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
|
533 |
}
|
534 |
|
535 |
// Add to cart button.
|
536 |
-
if ( get_theme_mod( 'wc_pac_add_to_cart' ) === false ) {
|
537 |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
538 |
}
|
539 |
|
540 |
// Thumbnail.
|
541 |
-
if ( get_theme_mod( 'wc_pac_thumbnail' ) === false ) {
|
542 |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
|
543 |
}
|
544 |
|
545 |
// Price.
|
546 |
-
if ( get_theme_mod( 'wc_pac_price' ) === false ) {
|
547 |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
|
548 |
}
|
549 |
|
550 |
// Rating.
|
551 |
-
if ( get_theme_mod( 'wc_pac_rating' ) === false ) {
|
552 |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
|
553 |
}
|
554 |
|
555 |
// New Badge.
|
556 |
-
if ( get_theme_mod( 'wc_pac_new_badge' ) === true ) {
|
557 |
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'woocommerce_pac_show_product_loop_new_badge' ), 30 );
|
558 |
}
|
559 |
|
560 |
// Stock.
|
561 |
-
if ( get_theme_mod( 'wc_pac_stock' ) === true ) {
|
562 |
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_stock' ), 30 );
|
563 |
}
|
564 |
|
565 |
// Categories.
|
566 |
-
if ( get_theme_mod( 'wc_pac_categories' ) === true ) {
|
567 |
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_categories' ), 30 );
|
568 |
}
|
569 |
}
|
@@ -587,7 +587,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
587 |
* @return string per page cookie
|
588 |
*/
|
589 |
function woocommerce_pac_products_per_page() {
|
590 |
-
$per_page = get_theme_mod( 'wc_pac_products_per_page' );
|
591 |
|
592 |
return $per_page;
|
593 |
}
|
@@ -599,7 +599,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
599 |
* @return array new body classes
|
600 |
*/
|
601 |
function woocommerce_pac_columns( $classes ) {
|
602 |
-
$columns = get_theme_mod( 'wc_pac_columns' );
|
603 |
$classes[] = 'product-columns-' . $columns;
|
604 |
return $classes;
|
605 |
}
|
@@ -610,7 +610,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
610 |
* @return int product columns
|
611 |
*/
|
612 |
function woocommerce_pac_products_row() {
|
613 |
-
$columns = get_theme_mod( 'wc_pac_columns' );
|
614 |
|
615 |
return $columns;
|
616 |
}
|
@@ -623,7 +623,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
623 |
function woocommerce_pac_show_product_loop_new_badge() {
|
624 |
$postdate = get_the_time( 'Y-m-d' ); // Post date.
|
625 |
$postdatestamp = strtotime( $postdate ); // Timestamped post date.
|
626 |
-
$newness = get_theme_mod( 'wc_pac_newness' ); // Newness in days as defined by option.
|
627 |
|
628 |
// If the product was published within the newness time frame display the new badge.
|
629 |
if ( ( time() - ( 60 * 60 * 24 * $newness ) ) < $postdatestamp ) {
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: WooCommerce Product Archive Customiser
|
4 |
+
* Plugin URI: https://wordpress.org/plugins/woocommerce-product-archive-customiser/
|
5 |
+
* Version: 1.0.2
|
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
|
9 |
* Author URI: http://jameskoster.co.uk
|
10 |
* Text Domain: woocommerce-product-archive-customiser
|
11 |
* Domain Path: /languages/
|
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 );
|
523 |
}
|
524 |
|
525 |
// Result Count.
|
526 |
+
if ( get_theme_mod( 'wc_pac_product_count', true ) === false ) {
|
527 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
|
528 |
}
|
529 |
|
530 |
// Product Ordering.
|
531 |
+
if ( get_theme_mod( 'wc_pac_product_sorting', true ) === false ) {
|
532 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
|
533 |
}
|
534 |
|
535 |
// Add to cart button.
|
536 |
+
if ( get_theme_mod( 'wc_pac_add_to_cart', true ) === false ) {
|
537 |
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
|
538 |
}
|
539 |
|
540 |
// Thumbnail.
|
541 |
+
if ( get_theme_mod( 'wc_pac_thumbnail', true ) === false ) {
|
542 |
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
|
543 |
}
|
544 |
|
545 |
// Price.
|
546 |
+
if ( get_theme_mod( 'wc_pac_price', true ) === false ) {
|
547 |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
|
548 |
}
|
549 |
|
550 |
// Rating.
|
551 |
+
if ( get_theme_mod( 'wc_pac_rating', true ) === false ) {
|
552 |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
|
553 |
}
|
554 |
|
555 |
// New Badge.
|
556 |
+
if ( get_theme_mod( 'wc_pac_new_badge', false ) === true ) {
|
557 |
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'woocommerce_pac_show_product_loop_new_badge' ), 30 );
|
558 |
}
|
559 |
|
560 |
// Stock.
|
561 |
+
if ( get_theme_mod( 'wc_pac_stock', false ) === true ) {
|
562 |
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_stock' ), 30 );
|
563 |
}
|
564 |
|
565 |
// Categories.
|
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 |
}
|
587 |
* @return string per page cookie
|
588 |
*/
|
589 |
function woocommerce_pac_products_per_page() {
|
590 |
+
$per_page = get_theme_mod( 'wc_pac_products_per_page', 10 );
|
591 |
|
592 |
return $per_page;
|
593 |
}
|
599 |
* @return array new body classes
|
600 |
*/
|
601 |
function woocommerce_pac_columns( $classes ) {
|
602 |
+
$columns = get_theme_mod( 'wc_pac_columns', 4 );
|
603 |
$classes[] = 'product-columns-' . $columns;
|
604 |
return $classes;
|
605 |
}
|
610 |
* @return int product columns
|
611 |
*/
|
612 |
function woocommerce_pac_products_row() {
|
613 |
+
$columns = get_theme_mod( 'wc_pac_columns', 4 );
|
614 |
|
615 |
return $columns;
|
616 |
}
|
623 |
function woocommerce_pac_show_product_loop_new_badge() {
|
624 |
$postdate = get_the_time( 'Y-m-d' ); // Post date.
|
625 |
$postdatestamp = strtotime( $postdate ); // Timestamped post date.
|
626 |
+
$newness = get_theme_mod( 'wc_pac_newness', 7 ); // Newness in days as defined by option.
|
627 |
|
628 |
// If the product was published within the newness time frame display the new badge.
|
629 |
if ( ( time() - ( 60 * 60 * 24 * $newness ) ) < $postdatestamp ) {
|