WooCommerce Products Per Page - Version 1.1.6

Version Description

  • 20/03/2015 =

  • Improvement/fix - Setting the per_page query object. Preventing/fixing notices.

Download this release

Release Info

Developer sormano
Plugin Icon 128x128 WooCommerce Products Per Page
Version 1.1.6
Comparing to
See all releases

Code changes from version 1.1.5 to 1.1.6

Files changed (2) hide show
  1. readme.txt +6 -2
  2. woocommerce-products-per-page.php +3 -5
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.jeroensormani.com/donate/
4
  Tags: Products per page, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
5
  Requires at least: 3.6.0
6
  Tested up to: 4.1
7
- Stable tag: 1.1.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -44,7 +44,11 @@ Options like:
44
 
45
  == Changelog ==
46
 
47
- = 1.1.4 - 15/02/2015 =
 
 
 
 
48
 
49
  * Fix - Console notice in rare cases after WC 2.3 update
50
 
4
  Tags: Products per page, woocommerce products, woocommerce products per page, woocommerce displayed products, woocommerce quantity products, woocommerce amount of products, woocommerce number of products, woocommerce shown products
5
  Requires at least: 3.6.0
6
  Tested up to: 4.1
7
+ Stable tag: 1.1.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
44
 
45
  == Changelog ==
46
 
47
+ = 1.1.6 - 20/03/2015 =
48
+
49
+ * Improvement/fix - Setting the per_page query object. Preventing/fixing notices.
50
+
51
+ = 1.1.5 - 15/02/2015 =
52
 
53
  * Fix - Console notice in rare cases after WC 2.3 update
54
 
woocommerce-products-per-page.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Woocommerce Products Per Page
4
  * Plugin URI: http://www.jeroensormani.com/
5
  * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
6
- * Version: 1.1.5
7
  * Author: Jeroen Sormani
8
  * Author URI: http://www.jeroensormani.com
9
 
@@ -100,7 +100,7 @@ class Woocommerce_Products_Per_Page {
100
 
101
  // Customer number of products per page
102
  add_filter( 'loop_shop_per_page', array( $this, 'wppp_loop_shop_per_page' ) );
103
- add_filter( 'pre_get_posts', array( $this, 'wppp_pre_get_posts' ), 1, 50 );
104
 
105
  // Set cookie so PPP will be saved
106
  add_action( 'init', array( $this, 'wppp_set_customer_session' ), 10 );
@@ -284,14 +284,12 @@ class Woocommerce_Products_Per_Page {
284
  *
285
  * @return object Query object
286
  */
287
- public function wppp_pre_get_posts( $q ) {
288
 
289
  if ( function_exists( 'woocommerce_products_will_display' ) && woocommerce_products_will_display() && $q->is_main_query() && ! is_admin() ) :
290
  $q->set( 'posts_per_page', $this->wppp_loop_shop_per_page() );
291
  endif;
292
 
293
- return $q;
294
-
295
  }
296
 
297
 
3
  * Plugin Name: Woocommerce Products Per Page
4
  * Plugin URI: http://www.jeroensormani.com/
5
  * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>!
6
+ * Version: 1.1.6
7
  * Author: Jeroen Sormani
8
  * Author URI: http://www.jeroensormani.com
9
 
100
 
101
  // Customer number of products per page
102
  add_filter( 'loop_shop_per_page', array( $this, 'wppp_loop_shop_per_page' ) );
103
+ add_action( 'woocommerce_product_query', array( $this, 'wppp_pre_get_posts' ), 2, 50 );
104
 
105
  // Set cookie so PPP will be saved
106
  add_action( 'init', array( $this, 'wppp_set_customer_session' ), 10 );
284
  *
285
  * @return object Query object
286
  */
287
+ public function wppp_pre_get_posts( $q, $class ) {
288
 
289
  if ( function_exists( 'woocommerce_products_will_display' ) && woocommerce_products_will_display() && $q->is_main_query() && ! is_admin() ) :
290
  $q->set( 'posts_per_page', $this->wppp_loop_shop_per_page() );
291
  endif;
292
 
 
 
293
  }
294
 
295