Version Description
- 10/06/2013 =
- Product column settings now affect product categories & tags
- Product categories display inline for better theme compatibility
- Stripped object pass by reference
Download this release
Release Info
Developer | jameskoster |
Plugin | WooCommerce Product Archive Customiser |
Version | 0.1.1 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.1.1
- archive-customiser.php +14 -14
- assets/css/pac.css +1 -1
- assets/css/pac.less +3 -0
- readme.txt +7 -2
archive-customiser.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: WooCommerce Product Archive Customiser
|
4 |
Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
|
5 |
-
Version: 0.1
|
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: 3.6
|
@@ -32,7 +32,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
32 |
class WC_pac {
|
33 |
|
34 |
public function __construct() {
|
35 |
-
add_action( 'wp_enqueue_scripts', array(
|
36 |
|
37 |
// Init settings
|
38 |
$this->settings = array(
|
@@ -150,11 +150,11 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
150 |
|
151 |
|
152 |
// Admin
|
153 |
-
add_action( 'woocommerce_settings_catalog_options_after', array(
|
154 |
-
add_action( 'woocommerce_update_options_catalog', array(
|
155 |
-
add_action( 'admin_enqueue_scripts', array(
|
156 |
-
add_action( 'init', array(
|
157 |
-
add_action( 'wp', array(
|
158 |
|
159 |
}
|
160 |
|
@@ -197,7 +197,7 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
197 |
function wc_pac_fire_customisations() {
|
198 |
|
199 |
// Products per page
|
200 |
-
add_filter( 'loop_shop_per_page', array(
|
201 |
|
202 |
// Sale flash
|
203 |
if ( get_option( 'wc_pac_sale_flash' ) == 'no' ) {
|
@@ -236,26 +236,26 @@ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', g
|
|
236 |
|
237 |
// New Badge
|
238 |
if ( get_option( 'wc_pac_new_badge' ) == 'yes' ) {
|
239 |
-
add_action( 'woocommerce_before_shop_loop_item_title', array(
|
240 |
}
|
241 |
|
242 |
// Stock
|
243 |
if ( get_option( 'wc_pac_stock' ) == 'yes' ) {
|
244 |
-
add_action( 'woocommerce_after_shop_loop_item', array(
|
245 |
}
|
246 |
|
247 |
// Categories
|
248 |
if ( get_option( 'wc_pac_categories' ) == 'yes' ) {
|
249 |
-
add_action( 'woocommerce_after_shop_loop_item', array(
|
250 |
}
|
251 |
}
|
252 |
|
253 |
// Product columns
|
254 |
function wc_pac_columns() {
|
255 |
// Product columns
|
256 |
-
if (
|
257 |
-
add_filter( 'body_class', array(
|
258 |
-
add_filter( 'loop_shop_columns', array(
|
259 |
}
|
260 |
}
|
261 |
|
2 |
/*
|
3 |
Plugin Name: WooCommerce Product Archive Customiser
|
4 |
Plugin URI: http://jameskoster.co.uk/tag/product-archive-customiser/
|
5 |
+
Version: 0.1.1
|
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: 3.6
|
32 |
class WC_pac {
|
33 |
|
34 |
public function __construct() {
|
35 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wc_pac_styles' ) );
|
36 |
|
37 |
// Init settings
|
38 |
$this->settings = array(
|
150 |
|
151 |
|
152 |
// Admin
|
153 |
+
add_action( 'woocommerce_settings_catalog_options_after', array( $this, 'admin_settings' ), 20);
|
154 |
+
add_action( 'woocommerce_update_options_catalog', array( $this, 'save_admin_settings' ) );
|
155 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'wc_pac_admin_scripts' ) );
|
156 |
+
add_action( 'init', array( $this, 'wc_pac_fire_customisations' ) );
|
157 |
+
add_action( 'wp', array( $this, 'wc_pac_columns' ) ); // This doesn't work when hooked into init :(
|
158 |
|
159 |
}
|
160 |
|
197 |
function wc_pac_fire_customisations() {
|
198 |
|
199 |
// Products per page
|
200 |
+
add_filter( 'loop_shop_per_page', array( $this, 'woocommerce_pac_products_per_page' ), 20 );
|
201 |
|
202 |
// Sale flash
|
203 |
if ( get_option( 'wc_pac_sale_flash' ) == 'no' ) {
|
236 |
|
237 |
// New Badge
|
238 |
if ( get_option( 'wc_pac_new_badge' ) == 'yes' ) {
|
239 |
+
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'woocommerce_pac_show_product_loop_new_badge' ), 30 );
|
240 |
}
|
241 |
|
242 |
// Stock
|
243 |
if ( get_option( 'wc_pac_stock' ) == 'yes' ) {
|
244 |
+
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_stock' ), 30 );
|
245 |
}
|
246 |
|
247 |
// Categories
|
248 |
if ( get_option( 'wc_pac_categories' ) == 'yes' ) {
|
249 |
+
add_action( 'woocommerce_after_shop_loop_item', array( $this, 'woocommerce_pac_show_product_categories' ), 30 );
|
250 |
}
|
251 |
}
|
252 |
|
253 |
// Product columns
|
254 |
function wc_pac_columns() {
|
255 |
// Product columns
|
256 |
+
if ( is_shop() || is_product_category() || is_product_tag() ) {
|
257 |
+
add_filter( 'body_class', array( $this, 'woocommerce_pac_columns' ) );
|
258 |
+
add_filter( 'loop_shop_columns', array( $this, 'woocommerce_pac_products_row' ) );
|
259 |
}
|
260 |
}
|
261 |
|
assets/css/pac.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
ul.products li.product .wc-new-badge{font-size:.75em;text-transform:uppercase;color:white;background:#eb4649;padding:.2em .5em;display:inline-block;font-weight:700;border-radius:2px}ul.products li.product .stock{display:block;padding-top:.5em}ul.products li.product .stock.out-of-stock{color:#eb4649}ul.products li.product .stock.in-stock{color:#85ad74}ul.products li.product .categories{display:block;padding-top:.5em}
|
1 |
+
ul.products li.product .wc-new-badge{font-size:.75em;text-transform:uppercase;color:white;background:#eb4649;padding:.2em .5em;display:inline-block;font-weight:700;border-radius:2px}ul.products li.product .stock{display:block;padding-top:.5em}ul.products li.product .stock.out-of-stock{color:#eb4649}ul.products li.product .stock.in-stock{color:#85ad74}ul.products li.product .categories{display:block;padding-top:.5em}ul.products li.product .categories a{display:inline}
|
assets/css/pac.less
CHANGED
@@ -23,6 +23,9 @@ ul.products {
|
|
23 |
.categories {
|
24 |
display: block;
|
25 |
padding-top:.5em;
|
|
|
|
|
|
|
26 |
}
|
27 |
}
|
28 |
}
|
23 |
.categories {
|
24 |
display: block;
|
25 |
padding-top:.5em;
|
26 |
+
a {
|
27 |
+
display: inline;
|
28 |
+
}
|
29 |
}
|
30 |
}
|
31 |
}
|
readme.txt
CHANGED
@@ -3,11 +3,11 @@ Contributors: jameskoster
|
|
3 |
Tags: woocommerce, ecommerce, products
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.6
|
6 |
-
Stable tag: 0.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
Customise the
|
11 |
|
12 |
== Description ==
|
13 |
|
@@ -49,5 +49,10 @@ function remove_pac_styles() {
|
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
= 0.1 =
|
53 |
Initial release.
|
3 |
Tags: woocommerce, ecommerce, products
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.6
|
6 |
+
Stable tag: 0.1.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Customise the appearance of product archives in WooCommerce.
|
11 |
|
12 |
== Description ==
|
13 |
|
49 |
|
50 |
== Changelog ==
|
51 |
|
52 |
+
= 0.1.1 - 10/06/2013 =
|
53 |
+
* Product column settings now affect product categories & tags
|
54 |
+
* Product categories display inline for better theme compatibility
|
55 |
+
* Stripped object pass by reference
|
56 |
+
|
57 |
= 0.1 =
|
58 |
Initial release.
|