Version Description
- Please upgrade immediately - Compatible with WordPress 5.0 and PHP 7.3
=
Download this release
Release Info
| Developer | hiddenpearls |
| Plugin | |
| Version | 1.6.6 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.5 to 1.6.6
- readme.txt +10 -59
- related-posts-thumbnails.php +43 -11
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: marynixie, 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:
|
| 7 |
-
Stable tag: 1.6.
|
| 8 |
License: GPLv3 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
|
@@ -67,11 +67,16 @@ If there are no images of the specified size in the post, or file does not exist
|
|
| 67 |
|
| 68 |
== Upgrade Notice ==
|
| 69 |
|
| 70 |
-
= 1.6.
|
| 71 |
-
* Please upgrade immediately -
|
| 72 |
|
| 73 |
== Changelog ==
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
= 1.6.5 - 2018-06-14 =
|
| 76 |
* Bug Fix : Last update broke layout because of direct function usage in templates.
|
| 77 |
|
|
@@ -201,58 +206,4 @@ If there are no images of the specified size in the post, or file does not exist
|
|
| 201 |
* added post custom field name option as a source for thumbnails
|
| 202 |
|
| 203 |
= 1.0 =
|
| 204 |
-
* Released plugin initial version
|
| 205 |
-
|
| 206 |
-
== Upgrade Notice ==
|
| 207 |
-
|
| 208 |
-
= 1.6.0 =
|
| 209 |
-
* Upgrade immediately - Multiple bugfixes and compatible with 4.8
|
| 210 |
-
|
| 211 |
-
= 1.5.1 =
|
| 212 |
-
|
| 213 |
-
[BugFix] Removed deprecated constructors for Related Posts widget. Compatible with PHP 7.0
|
| 214 |
-
|
| 215 |
-
= 1.5.0 =
|
| 216 |
-
Major UI changes for admin settings and compatibility with WP 4.5
|
| 217 |
-
|
| 218 |
-
= 1.3 =
|
| 219 |
-
Added support of custom types and taxonomies, fixed double quotes and shortcodes
|
| 220 |
-
|
| 221 |
-
= 1.2.9 =
|
| 222 |
-
Fixed bug when not all categories selected and tags only, removed image file existence check
|
| 223 |
-
|
| 224 |
-
= 1.2.8 =
|
| 225 |
-
Fixed bug with only one post in category, accept quotes in font family, Turkish and German versions
|
| 226 |
-
|
| 227 |
-
= 1.2.7 =
|
| 228 |
-
Added clean HTML option without plugin CSS, fixed background color change
|
| 229 |
-
|
| 230 |
-
= 1.2.6 =
|
| 231 |
-
Fixed relative custom URL
|
| 232 |
-
|
| 233 |
-
= 1.2.5 =
|
| 234 |
-
Fixed selection of categories on plugin settings page
|
| 235 |
-
|
| 236 |
-
= 1.2.4 =
|
| 237 |
-
Last French version
|
| 238 |
-
|
| 239 |
-
= 1.2.3 =
|
| 240 |
-
Added option to set theme php resizing script
|
| 241 |
-
|
| 242 |
-
= 1.2.2 =
|
| 243 |
-
In this version: improved performance, start date, separated categories, PHP 4.3 compatible, php configuration check, no relation option.
|
| 244 |
-
|
| 245 |
-
= 1.2.1 =
|
| 246 |
-
French version included, generation of excerpt, developer mode.
|
| 247 |
-
|
| 248 |
-
= 1.2 =
|
| 249 |
-
This version supports php tag, title and excerpt length, sidebar widget.
|
| 250 |
-
|
| 251 |
-
= 1.1.1 =
|
| 252 |
-
This version includes elimination of warning on settings page some may experience, plus full html support in top text field.
|
| 253 |
-
|
| 254 |
-
= 1.1 =
|
| 255 |
-
This version includes categories/tags confusion in settings, elimination of warnings in case of wrong headers, new features - Categories and custom field support.
|
| 256 |
-
|
| 257 |
-
= 1.0 =
|
| 258 |
-
The first released version
|
| 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.0
|
| 7 |
+
Stable tag: 1.6.6
|
| 8 |
License: GPLv3 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
| 67 |
|
| 68 |
== Upgrade Notice ==
|
| 69 |
|
| 70 |
+
= 1.6.6 =
|
| 71 |
+
* Please upgrade immediately - Compatible with WordPress 5.0 and PHP 7.3
|
| 72 |
|
| 73 |
== Changelog ==
|
| 74 |
|
| 75 |
+
= 1.6.6 - 2019-03-18 =
|
| 76 |
+
* Enhancement : Add `posts_number` & `posts_sort` attributes in [related-posts-thumbnails] shortcode.
|
| 77 |
+
* Compatibility : Compatible with WordPress 5.1
|
| 78 |
+
* Enhancement : Compatible with PHP 7.3
|
| 79 |
+
|
| 80 |
= 1.6.5 - 2018-06-14 =
|
| 81 |
* Bug Fix : Last update broke layout because of direct function usage in templates.
|
| 82 |
|
| 206 |
* added post custom field name option as a source for thumbnails
|
| 207 |
|
| 208 |
= 1.0 =
|
| 209 |
+
* Released plugin initial version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
related-posts-thumbnails.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 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.6.
|
| 7 |
* Author: WPBrigade
|
| 8 |
* Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
|
| 9 |
*/
|
|
@@ -81,10 +81,6 @@ class RelatedPostsThumbnails {
|
|
| 81 |
$this,
|
| 82 |
'admin_menu'
|
| 83 |
) );
|
| 84 |
-
add_shortcode( 'related-posts-thumbnails', array(
|
| 85 |
-
$this,
|
| 86 |
-
'get_html'
|
| 87 |
-
) );
|
| 88 |
|
| 89 |
$this->wp_version = get_bloginfo( 'version' );
|
| 90 |
|
|
@@ -110,6 +106,30 @@ class RelatedPostsThumbnails {
|
|
| 110 |
$this,
|
| 111 |
'head_style'
|
| 112 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
function admin_scripts( $page ) {
|
|
@@ -383,17 +403,20 @@ class RelatedPostsThumbnails {
|
|
| 383 |
|
| 384 |
}
|
| 385 |
|
| 386 |
-
function get_thumbnails( $show_top = false ) {
|
| 387 |
|
| 388 |
// Retrieve Related Posts HTML for output
|
| 389 |
$output = '';
|
| 390 |
$debug = 'Developer mode initialisation; Version: 1.2.9;';
|
| 391 |
$time = microtime( true );
|
| 392 |
-
$
|
|
|
|
| 393 |
$height = '';
|
| 394 |
$width = '';
|
| 395 |
// $date = '';
|
| 396 |
-
|
|
|
|
|
|
|
| 397 |
|
| 398 |
// rpt_content_align: add content allignment class; clases are: relpost-align-left, relpost-align-right and relpost-align-center
|
| 399 |
$output = '<!-- relpost-thumb-wrapper -->';
|
|
@@ -489,14 +512,21 @@ class RelatedPostsThumbnails {
|
|
| 489 |
$relationships = $wpdb->get_results( $query_objects );
|
| 490 |
$related_objects = array();
|
| 491 |
if ( count( $relationships ) > 0 ) {
|
| 492 |
-
foreach ( $relationships as $item ) {
|
| 493 |
$related_objects[] = $item->object_id;
|
| 494 |
}
|
| 495 |
}
|
| 496 |
}
|
| 497 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
$query = "SELECT distinct ID FROM $wpdb->posts ";
|
| 499 |
-
$where = " WHERE post_type = '" . $post_type . "' AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
|
|
|
| 500 |
$startdate = get_option( 'relpoststh_startdate' );
|
| 501 |
if ( !empty( $startdate ) && preg_match( '/^\d\d\d\d-\d\d-\d\d$/', $startdate ) ) { // If startdate was set
|
| 502 |
$debug .= "Startdate: $startdate;";
|
|
@@ -705,6 +735,7 @@ class RelatedPostsThumbnails {
|
|
| 705 |
$fontface = str_replace( '"', "'", stripslashes( get_option( 'relpoststh_fontfamily', $this->font_family ) ) );
|
| 706 |
|
| 707 |
$debug .= 'Using title with size ' . $text_length . '. Using excerpt with size ' . $excerpt_length . ';';
|
|
|
|
| 708 |
|
| 709 |
if ( $relpoststh_output_style == 'list' ) {
|
| 710 |
$link = get_permalink( $post->ID );
|
|
@@ -724,13 +755,14 @@ class RelatedPostsThumbnails {
|
|
| 724 |
$output .= ' style="width: ' . $width . 'px;height: ' . $text_height . 'px; font-family: ' . $fontface . '; "';
|
| 725 |
}
|
| 726 |
// $output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $date . '</a></li>';
|
| 727 |
-
$output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $
|
| 728 |
}
|
| 729 |
} else {
|
| 730 |
$output .= '<a class="relpost-block-single" href="' . get_permalink( $post->ID ) . '">';
|
| 731 |
$output .= '<div style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
|
| 732 |
$output .= '<div class="relpost-block-single-image" alt="' . $alt . '" style=" background: transparent url(' . esc_url( $url ) . ') no-repeat scroll 0% 0%; width: ' . $width . 'px; height: ' . $height . 'px; "></div>';
|
| 733 |
$output .= '<div class="relpost-block-single-text" style="font-family: ' . $fontface . '; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . $excerpt . '</div>';
|
|
|
|
| 734 |
// $output .= $date;
|
| 735 |
$output .= '</div>';
|
| 736 |
$output .= '</a>';
|
| 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.6.6
|
| 7 |
* Author: WPBrigade
|
| 8 |
* Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
|
| 9 |
*/
|
| 81 |
$this,
|
| 82 |
'admin_menu'
|
| 83 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
$this->wp_version = get_bloginfo( 'version' );
|
| 86 |
|
| 106 |
$this,
|
| 107 |
'head_style'
|
| 108 |
) );
|
| 109 |
+
|
| 110 |
+
add_shortcode( 'related-posts-thumbnails', array( $this, 'related_posts_shortcode' ) );
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
function related_posts_shortcode( $atts ) {
|
| 114 |
+
$atts = shortcode_atts( array(
|
| 115 |
+
'posts_number' => '3',
|
| 116 |
+
'posts_sort' => 'random'
|
| 117 |
+
), $atts, 'related-posts-thumbnails'
|
| 118 |
+
);
|
| 119 |
+
|
| 120 |
+
$number = $atts['posts_number'];
|
| 121 |
+
|
| 122 |
+
if ( $atts['posts_sort'] == 'random' ) {
|
| 123 |
+
$sort = 'rand()';
|
| 124 |
+
} elseif ( $atts['posts_sort'] == 'latest' ) {
|
| 125 |
+
$sort = 'post_date';
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
if ( !is_numeric( $number ) ) {
|
| 129 |
+
$number = 3;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
return $this->get_thumbnails( true, $number, $sort );
|
| 133 |
}
|
| 134 |
|
| 135 |
function admin_scripts( $page ) {
|
| 403 |
|
| 404 |
}
|
| 405 |
|
| 406 |
+
function get_thumbnails( $show_top = false, $posts_number_short = '', $sort_by_short = '' ) {
|
| 407 |
|
| 408 |
// Retrieve Related Posts HTML for output
|
| 409 |
$output = '';
|
| 410 |
$debug = 'Developer mode initialisation; Version: 1.2.9;';
|
| 411 |
$time = microtime( true );
|
| 412 |
+
$posts_number_opt = get_option( 'relpoststh_number', $this->number );
|
| 413 |
+
$posts_number = !empty( $posts_number_short ) ? $posts_number_short : $posts_number_opt;
|
| 414 |
$height = '';
|
| 415 |
$width = '';
|
| 416 |
// $date = '';
|
| 417 |
+
|
| 418 |
+
$sort_by_opt = get_option( 'rpt_post_sort') == 'latest' ? 'post_date': 'rand()';
|
| 419 |
+
$sort_by = !empty( $sort_by_short ) ? $sort_by_short : $sort_by_opt;
|
| 420 |
|
| 421 |
// rpt_content_align: add content allignment class; clases are: relpost-align-left, relpost-align-right and relpost-align-center
|
| 422 |
$output = '<!-- relpost-thumb-wrapper -->';
|
| 512 |
$relationships = $wpdb->get_results( $query_objects );
|
| 513 |
$related_objects = array();
|
| 514 |
if ( count( $relationships ) > 0 ) {
|
| 515 |
+
foreach ( $relationships as $item ) {
|
| 516 |
$related_objects[] = $item->object_id;
|
| 517 |
}
|
| 518 |
}
|
| 519 |
}
|
| 520 |
|
| 521 |
+
// $selected_post_type = '';
|
| 522 |
+
// foreach( get_option ( 'relpoststh_post_types' ) as $checked_post_type ) {
|
| 523 |
+
// $selected_post_type .= "'".$checked_post_type."',";
|
| 524 |
+
// }
|
| 525 |
+
// $checked_post_type = rtrim( $selected_post_type, ',' );
|
| 526 |
+
|
| 527 |
$query = "SELECT distinct ID FROM $wpdb->posts ";
|
| 528 |
+
$where = " WHERE post_type = '" . $post_type . "' AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
| 529 |
+
// $where = " WHERE post_type IN (" . $checked_post_type . ") AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
| 530 |
$startdate = get_option( 'relpoststh_startdate' );
|
| 531 |
if ( !empty( $startdate ) && preg_match( '/^\d\d\d\d-\d\d-\d\d$/', $startdate ) ) { // If startdate was set
|
| 532 |
$debug .= "Startdate: $startdate;";
|
| 735 |
$fontface = str_replace( '"', "'", stripslashes( get_option( 'relpoststh_fontfamily', $this->font_family ) ) );
|
| 736 |
|
| 737 |
$debug .= 'Using title with size ' . $text_length . '. Using excerpt with size ' . $excerpt_length . ';';
|
| 738 |
+
$after_content = apply_filters( 'rpth_after_content', '', $post );
|
| 739 |
|
| 740 |
if ( $relpoststh_output_style == 'list' ) {
|
| 741 |
$link = get_permalink( $post->ID );
|
| 755 |
$output .= ' style="width: ' . $width . 'px;height: ' . $text_height . 'px; font-family: ' . $fontface . '; "';
|
| 756 |
}
|
| 757 |
// $output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $date . '</a></li>';
|
| 758 |
+
$output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $after_content . '</a></li>';
|
| 759 |
}
|
| 760 |
} else {
|
| 761 |
$output .= '<a class="relpost-block-single" href="' . get_permalink( $post->ID ) . '">';
|
| 762 |
$output .= '<div style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
|
| 763 |
$output .= '<div class="relpost-block-single-image" alt="' . $alt . '" style=" background: transparent url(' . esc_url( $url ) . ') no-repeat scroll 0% 0%; width: ' . $width . 'px; height: ' . $height . 'px; "></div>';
|
| 764 |
$output .= '<div class="relpost-block-single-text" style="font-family: ' . $fontface . '; font-size: ' . get_option( 'relpoststh_fontsize', $this->font_size ) . 'px; color: ' . get_option( 'relpoststh_fontcolor', $this->font_color ) . ';">' . $title . $excerpt . '</div>';
|
| 765 |
+
$output .= $after_content;
|
| 766 |
// $output .= $date;
|
| 767 |
$output .= '</div>';
|
| 768 |
$output .= '</a>';
|
