Related Posts Thumbnails Plugin for WordPress - Version 1.9.2

Version Description

  • Please upgrade immediately.

=

Download this release

Release Info

Developer hiddenpearls
Plugin Icon 128x128 Related Posts Thumbnails Plugin for WordPress
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.2

assets/css/front.css CHANGED
@@ -146,7 +146,7 @@
146
  margin-right: -1px;
147
  margin-bottom: 5px;
148
  overflow: hidden;
149
- border: 0 !important;
150
  }
151
 
152
  .relpost-block-single-image {
146
  margin-right: -1px;
147
  margin-bottom: 5px;
148
  overflow: hidden;
149
+ border: 0;
150
  }
151
 
152
  .relpost-block-single-image {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: hiddenpearls, WPBrigade
3
  Donate link: https://wpbrigade.com/
4
  Tags: easy related posts, Related Posts thumbnails, Free Related Posts, related posts, similar related posts
5
  Requires at least: 3.6
6
- Tested up to: 5.7
7
- Stable tag: 1.9.1
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -71,11 +71,16 @@ If there are no images of the specified size in the post, or file does not exist
71
 
72
  == Upgrade Notice ==
73
 
74
- = 1.9.1 =
75
- * Please upgrade immediately - Introducing filters for developers to extend Related Posts
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
79
  = 1.9.1 - 2021-04-08 =
80
  * Bugfix: Mobile view layout.
81
  * New Feature : Introducing Lazy Loading filter. Use `rpt-lazy-loading` filter to enable the lazy loading for thumbnails. By default it's false.
3
  Donate link: https://wpbrigade.com/
4
  Tags: easy related posts, Related Posts thumbnails, Free Related Posts, related posts, similar related posts
5
  Requires at least: 3.6
6
+ Tested up to: 5.9
7
+ Stable tag: 1.9.2
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
71
 
72
  == Upgrade Notice ==
73
 
74
+ = 1.9.2 =
75
+ * Please upgrade immediately.
76
 
77
  == Changelog ==
78
 
79
+ = 1.9.2 - 2022-02-18 =
80
+ * Bugfix: Border style issue.
81
+ * Enhancement: Added a filter `relpost_anchor_attr` to extend the HTML attributes within the related posts thumbnails anchor tag.
82
+ * Compatibility : Compatible with WordPress 5.9
83
+
84
  = 1.9.1 - 2021-04-08 =
85
  * Bugfix: Mobile view layout.
86
  * New Feature : Introducing Lazy Loading filter. Use `rpt-lazy-loading` filter to enable the lazy loading for thumbnails. By default it's false.
related-posts-thumbnails.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: WordPress Related Posts Thumbnails
4
  * Plugin URI: https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=plugin-uri&utm_campaign=pro-upgrade-rp
5
  * Description: Showing related posts thumbnails under the posts.
6
- * Version: 1.9.1
7
  * Author: WPBrigade
8
  * Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
9
  */
10
 
11
  /*
12
- Copyright 2010 - 2021
13
 
14
  This product was first developed by Maria I Shaldybina and later on maintained and developed by Adnan (WPBrigade.com)
15
 
@@ -461,7 +461,7 @@ class RelatedPostsThumbnails {
461
  */
462
  function get_thumbnails( $show_top = false, $posts_number = '', $sort_by = '', $main_title = '', $exclude ='' ) {
463
  $output = '';
464
- $debug = 'Developer mode initialisation; Version: 1.2.9;';
465
  $time = microtime( true );
466
 
467
  $amp_endpoint = ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) ? true : false;
@@ -918,7 +918,59 @@ class RelatedPostsThumbnails {
918
  //if lazy-load is activated
919
  $rpt_lazy_single_background = apply_filters( 'rpt-lazy-loading', false );
920
 
921
- $output .= '<a class="relpost-block-single" href="' . get_permalink( $post->ID ) . '">';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  $output .= '<div class="relpost-custom-block-single" style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
923
 
924
  if( $rpt_lazy_single_background ) {
3
  * Plugin Name: WordPress Related Posts Thumbnails
4
  * Plugin URI: https://wpbrigade.com/wordpress/plugins/related-posts/?utm_source=related-posts-lite&utm_medium=plugin-uri&utm_campaign=pro-upgrade-rp
5
  * Description: Showing related posts thumbnails under the posts.
6
+ * Version: 1.9.2
7
  * Author: WPBrigade
8
  * Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
9
  */
10
 
11
  /*
12
+ Copyright 2010 - 2022
13
 
14
  This product was first developed by Maria I Shaldybina and later on maintained and developed by Adnan (WPBrigade.com)
15
 
461
  */
462
  function get_thumbnails( $show_top = false, $posts_number = '', $sort_by = '', $main_title = '', $exclude ='' ) {
463
  $output = '';
464
+ $debug = 'Developer mode initialization; Version: 1.2.9;';
465
  $time = microtime( true );
466
 
467
  $amp_endpoint = ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) ? true : false;
918
  //if lazy-load is activated
919
  $rpt_lazy_single_background = apply_filters( 'rpt-lazy-loading', false );
920
 
921
+ $rpt_anchor_attrs = array(
922
+ 'class' => '',
923
+ 'target' => false,
924
+ );
925
+
926
+ /**
927
+ * Filter to enhance the related post thumbnail anchor attribute such as open post in a new tab.
928
+ *
929
+ * @param int $post->ID Current post ID.
930
+ * @param array $rpt_anchor_attrs array of the attributes.
931
+ *
932
+ * @since 1.9.2
933
+ */
934
+ $rpt_anchor_attr_filter = (array) apply_filters( 'relpost_anchor_attr', $post->ID, $rpt_anchor_attrs );
935
+
936
+ /**
937
+ * Array Containing Allowed attributes.
938
+ */
939
+ $allowed_anchor_attrs = array( 'title', 'class', 'target' );
940
+
941
+ // Pattern for data-* attribute.
942
+ $data_attr_ptrn = "/data-/i";
943
+
944
+ $relpost_attributes = 'class="relpost-block-single';
945
+
946
+ // Attr sets for class including default class.
947
+ if ( array_key_exists( 'class', $rpt_anchor_attr_filter ) ) {
948
+
949
+ // Class attributes in string.
950
+ $class_attrs_str = esc_attr( wp_unslash( $rpt_anchor_attr_filter['class'] ) );
951
+ // Class attributes in array.
952
+ $class_attrs = explode( " ", $class_attrs_str );
953
+
954
+ foreach ( $class_attrs as $value ) {
955
+ if( 'relpost-block-single' !== $value && ! empty( $value ) ) {
956
+ $relpost_attributes .= ' ' . $value ;
957
+ }
958
+ }
959
+ }
960
+ $relpost_attributes .= '" ';
961
+
962
+ foreach ( $rpt_anchor_attr_filter as $rel_post_a_attr => $value ) {
963
+
964
+ $value = esc_attr( wp_unslash( $value ) );
965
+ $rel_post_a_attr = esc_attr( wp_unslash( $rel_post_a_attr ) );
966
+
967
+ if ( false !== $value && ! empty( $value ) && $rel_post_a_attr !== 'class' && ( in_array( $rel_post_a_attr, $allowed_anchor_attrs ) || preg_match( $data_attr_ptrn, $rel_post_a_attr ) ) ) {
968
+ $relpost_attributes .= $rel_post_a_attr . '="' . $value . '"';
969
+ }
970
+ }
971
+
972
+ $output .= '<a href="' . get_permalink( $post->ID ) . '"' . $relpost_attributes . '>';
973
+
974
  $output .= '<div class="relpost-custom-block-single" style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
975
 
976
  if( $rpt_lazy_single_background ) {