Storefront Product Pagination - Version 1.2.1

Version Description

  • 02.07.2017 =
  • Fix - Errors when no next/previous product exists.
Download this release

Release Info

Developer jameskoster
Plugin Icon 128x128 Storefront Product Pagination
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2.0 to 1.2.1

Files changed (2) hide show
  1. readme.txt +4 -2
  2. storefront-product-pagination.php +8 -6
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jameskoster, woothemes
3
  Tags: woocommerce, ecommerce, products, storefront, pagination, next, previous
4
  Requires at least: 4.0.0
5
  Tested up to: 4.7.1
6
- Stable tag: 1.2.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -30,13 +30,15 @@ First of all it's important to note that this plugin requires that <a href="http
30
 
31
  The links will appear on any single product page, providing there is more than one product at your store.
32
 
33
-
34
  == Screenshots ==
35
 
36
  1. The product pagination.
37
 
38
  == Changelog ==
39
 
 
 
 
40
  = 1.2.0 - 01.25.2017 =
41
  * New - Design tweaks.
42
  * Fix - Thumbnails when displaying next/prev products from the same category.
3
  Tags: woocommerce, ecommerce, products, storefront, pagination, next, previous
4
  Requires at least: 4.0.0
5
  Tested up to: 4.7.1
6
+ Stable tag: 1.2.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
30
 
31
  The links will appear on any single product page, providing there is more than one product at your store.
32
 
 
33
  == Screenshots ==
34
 
35
  1. The product pagination.
36
 
37
  == Changelog ==
38
 
39
+ = 1.2.1 - 02.07.2017 =
40
+ * Fix - Errors when no next/previous product exists.
41
+
42
  = 1.2.0 - 01.25.2017 =
43
  * New - Design tweaks.
44
  * Fix - Thumbnails when displaying next/prev products from the same category.
storefront-product-pagination.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Storefront Product Pagination
4
  * Plugin URI: http://woothemes.com/storefront/
5
  * Description: Add unobstrusive links to next/previous products on your WooCommerce single product pages.
6
- * Version: 1.2.0
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
@@ -90,7 +90,7 @@ final class Storefront_Product_Pagination {
90
  $this->token = 'storefront-product-pagination';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
- $this->version = '1.2.0';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
@@ -337,14 +337,15 @@ final class Storefront_Product_Pagination {
337
  $previous_product = get_previous_post( $same_cat, '', $taxonomy );
338
  $next_product = get_next_post( $same_cat, '', $taxonomy );
339
 
340
- $previous_product_data = new WC_Product( $previous_product->ID );
341
- $next_product_data = new WC_Product( $next_product->ID );
342
-
343
  $previous_product_thumbnail = '';
344
  $next_product_thumbnail = '';
345
 
 
 
 
346
  // If a next/previous product exists, get the thumbnail (or place holder).
347
  if ( $previous_product ) {
 
348
  $previous_product_thumbnail = get_the_post_thumbnail( $previous_product->ID, 'shop_catalog' );
349
 
350
  if ( ! $previous_product_thumbnail ) {
@@ -353,6 +354,7 @@ final class Storefront_Product_Pagination {
353
  }
354
 
355
  if ( $next_product ) {
 
356
  $next_product_thumbnail = get_the_post_thumbnail( $next_product->ID, 'shop_catalog' );
357
 
358
  if ( ! $next_product_thumbnail ) {
@@ -361,7 +363,7 @@ final class Storefront_Product_Pagination {
361
  }
362
 
363
  // Output the links.
364
- if ( ( $next_product || $previous_product ) && ( $previous_product_data->is_visible() || $next_product_data->is_visible() ) ) {
365
 
366
  echo '<nav class="storefront-single-product-pagination">';
367
 
3
  * Plugin Name: Storefront Product Pagination
4
  * Plugin URI: http://woothemes.com/storefront/
5
  * Description: Add unobstrusive links to next/previous products on your WooCommerce single product pages.
6
+ * Version: 1.2.1
7
  * Author: WooThemes
8
  * Author URI: http://woothemes.com/
9
  * Requires at least: 4.0.0
90
  $this->token = 'storefront-product-pagination';
91
  $this->plugin_url = plugin_dir_url( __FILE__ );
92
  $this->plugin_path = plugin_dir_path( __FILE__ );
93
+ $this->version = '1.2.1';
94
 
95
  register_activation_hook( __FILE__, array( $this, 'install' ) );
96
 
337
  $previous_product = get_previous_post( $same_cat, '', $taxonomy );
338
  $next_product = get_next_post( $same_cat, '', $taxonomy );
339
 
 
 
 
340
  $previous_product_thumbnail = '';
341
  $next_product_thumbnail = '';
342
 
343
+ $previous_product_data = '';
344
+ $next_product_data = '';
345
+
346
  // If a next/previous product exists, get the thumbnail (or place holder).
347
  if ( $previous_product ) {
348
+ $previous_product_data = new WC_Product( $previous_product->ID );
349
  $previous_product_thumbnail = get_the_post_thumbnail( $previous_product->ID, 'shop_catalog' );
350
 
351
  if ( ! $previous_product_thumbnail ) {
354
  }
355
 
356
  if ( $next_product ) {
357
+ $next_product_data = new WC_Product( $next_product->ID );
358
  $next_product_thumbnail = get_the_post_thumbnail( $next_product->ID, 'shop_catalog' );
359
 
360
  if ( ! $next_product_thumbnail ) {
363
  }
364
 
365
  // Output the links.
366
+ if ( $next_product || $previous_product ) {
367
 
368
  echo '<nav class="storefront-single-product-pagination">';
369