Yet Another Related Posts Plugin (YARPP) - Version 5.27.3

Version Description

(16-August-2021) = * Bugfix: Make $related_query available to custom templates

Download this release

Release Info

Developer jeffparker
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 5.27.3
Comparing to
See all releases

Code changes from version 5.27.2 to 5.27.3

Files changed (3) hide show
  1. classes/YARPP_Core.php +8 -6
  2. readme.txt +5 -2
  3. yarpp.php +2 -2
classes/YARPP_Core.php CHANGED
@@ -1500,7 +1500,6 @@ class YARPP {
1500
  );
1501
 
1502
  $related_query = $wp_query; // backwards compatibility
1503
- $related_count = $related_query->post_count;
1504
 
1505
  if ( $cache_status !== YARPP_NO_RELATED ) {
1506
  $this->active_cache->end_yarpp_time();
@@ -1510,7 +1509,7 @@ class YARPP {
1510
  // excerpt, which would trigger finding its related posts, which would show its related posts body or excerpt...
1511
  $this->rendering_related_content = true;
1512
 
1513
- $output = $this->get_template_content($reference_ID, $args, $related_count);
1514
 
1515
  $this->rendering_related_content = false;
1516
 
@@ -1523,7 +1522,12 @@ class YARPP {
1523
  return $output;
1524
  }
1525
 
1526
- protected function get_template_content( $reference_ID = null, $args, $related_count, $is_demo = false ) {
 
 
 
 
 
1527
  $options = array(
1528
  'domain',
1529
  'template',
@@ -1769,12 +1773,10 @@ class YARPP {
1769
  ) );
1770
 
1771
  $this->prep_query( $domain === 'rss' );
1772
- $related_query = $wp_query; // backwards compatibility
1773
- $related_count = $related_query->post_count;
1774
 
1775
  $this->demo_cache_bypass->end_demo_time();
1776
 
1777
- $output = $this->get_template_content(null, $args, $related_count, true);
1778
 
1779
  if ( $echo ) {
1780
  echo $output;
1500
  );
1501
 
1502
  $related_query = $wp_query; // backwards compatibility
 
1503
 
1504
  if ( $cache_status !== YARPP_NO_RELATED ) {
1505
  $this->active_cache->end_yarpp_time();
1509
  // excerpt, which would trigger finding its related posts, which would show its related posts body or excerpt...
1510
  $this->rendering_related_content = true;
1511
 
1512
+ $output = $this->get_template_content($reference_ID, $args);
1513
 
1514
  $this->rendering_related_content = false;
1515
 
1522
  return $output;
1523
  }
1524
 
1525
+ protected function get_template_content( $reference_ID = null, $args, $is_demo = false ) {
1526
+ // make $related_query available to custom templates. It may be in use by old custom templates
1527
+ global $wp_query;
1528
+ $related_query = $wp_query;
1529
+ $related_count = $wp_query->post_count;
1530
+
1531
  $options = array(
1532
  'domain',
1533
  'template',
1773
  ) );
1774
 
1775
  $this->prep_query( $domain === 'rss' );
 
 
1776
 
1777
  $this->demo_cache_bypass->end_demo_time();
1778
 
1779
+ $output = $this->get_template_content(null, $args, true);
1780
 
1781
  if ( $echo ) {
1782
  echo $output;
readme.txt CHANGED
@@ -6,7 +6,7 @@ Requires at least: 3.7
6
  Requires PHP: 5.3
7
  License: GPLv2 or later
8
  Tested up to: 5.8
9
- Stable tag: 5.27.2
10
 
11
  The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
12
 
@@ -529,6 +529,9 @@ Beginning with version 4.0.7, YARPP includes clean uninstall functionality. If y
529
 
530
 
531
  == Changelog ==
 
 
 
532
  = 5.27.2 (12-August-2021) =
533
  * New: Conversion of legacy widget YARPP block into YARPP Block
534
  * [Bugfix](https://wordpress.org/support/topic/display-in-sidebart-but-not-on-the-main-page/): New Blocks on widget's sections were showing on homepage
@@ -1410,5 +1413,5 @@ After a break of many years, the plugin is 100% supported now that the baton has
1410
  * Initial upload
1411
 
1412
  == Upgrade Notice ==
1413
- = 5.27.2 =
1414
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
6
  Requires PHP: 5.3
7
  License: GPLv2 or later
8
  Tested up to: 5.8
9
+ Stable tag: 5.27.3
10
 
11
  The best WordPress plugin for displaying related posts. Simple and flexible, with a powerful proven algorithm and inbuilt caching.
12
 
529
 
530
 
531
  == Changelog ==
532
+ = 5.27.3 (16-August-2021) =
533
+ * [Bugfix](https://wordpress.org/support/topic/fatal-error-for-custom-template-after-upgrading-5-27-2/): Make `$related_query` available to custom templates
534
+
535
  = 5.27.2 (12-August-2021) =
536
  * New: Conversion of legacy widget YARPP block into YARPP Block
537
  * [Bugfix](https://wordpress.org/support/topic/display-in-sidebart-but-not-on-the-main-page/): New Blocks on widget's sections were showing on homepage
1413
  * Initial upload
1414
 
1415
  == Upgrade Notice ==
1416
+ = 5.27.3 =
1417
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
yarpp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
- Version: 5.27.2
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
@@ -25,7 +25,7 @@ if ( ! defined( 'WP_CONTENT_DIR' ) ) {
25
  define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
26
  }
27
 
28
- define( 'YARPP_VERSION', '5.27.2' );
29
 
30
  define( 'YARPP_DIR', dirname( __FILE__ ) );
31
  /**
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
+ Version: 5.27.3
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
25
  define( 'WP_CONTENT_DIR', substr( $tr, 0, strrpos( $tr, '/' ) ) );
26
  }
27
 
28
+ define( 'YARPP_VERSION', '5.27.3' );
29
 
30
  define( 'YARPP_DIR', dirname( __FILE__ ) );
31
  /**