Version Description
- Please upgrade immediately.
=
Download this release
Release Info
| Developer | hiddenpearls |
| Plugin | |
| Version | 2.0.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.9.2 to 2.0.0
- assets/css/admin.css +3 -1
- assets/css/front.css +6 -0
- assets/js/admin.js +8 -1
- inc/rpt-settings.php +65 -10
- readme.txt +7 -2
- related-posts-thumbnails.php +73 -40
assets/css/admin.css
CHANGED
|
@@ -16,7 +16,9 @@
|
|
| 16 |
margin-bottom: 0;
|
| 17 |
margin-left: -1px;
|
| 18 |
}
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
#relpoststh-settings::after {
|
| 21 |
display: table;
|
| 22 |
content: "";
|
| 16 |
margin-bottom: 0;
|
| 17 |
margin-left: -1px;
|
| 18 |
}
|
| 19 |
+
#relpoststh-settings .relpoststh_date_format {
|
| 20 |
+
display: none;
|
| 21 |
+
}
|
| 22 |
#relpoststh-settings::after {
|
| 23 |
display: table;
|
| 24 |
content: "";
|
assets/css/front.css
CHANGED
|
@@ -149,6 +149,12 @@
|
|
| 149 |
border: 0;
|
| 150 |
}
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
.relpost-block-single-image {
|
| 153 |
border: 0 none;
|
| 154 |
margin: 0;
|
| 149 |
border: 0;
|
| 150 |
}
|
| 151 |
|
| 152 |
+
.rpth_list_date{
|
| 153 |
+
display: block;
|
| 154 |
+
padding-top: 5px
|
| 155 |
+
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
.relpost-block-single-image {
|
| 159 |
border: 0 none;
|
| 160 |
margin: 0;
|
assets/js/admin.js
CHANGED
|
@@ -109,7 +109,14 @@
|
|
| 109 |
$('#relpoststh-custom-field').show();
|
| 110 |
}
|
| 111 |
});
|
| 112 |
-
$('#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
if (this.value == 'list') {
|
| 114 |
$('#relpoststh_cleanhtml').show();
|
| 115 |
} else {
|
| 109 |
$('#relpoststh-custom-field').show();
|
| 110 |
}
|
| 111 |
});
|
| 112 |
+
$('#relpoststh_show_date').change(function() {
|
| 113 |
+
if ( $('#relpoststh_show_date').is(':checked') ) {
|
| 114 |
+
$('.relpoststh_date_format').fadeIn();
|
| 115 |
+
} else {
|
| 116 |
+
$('.relpoststh_date_format').hide();
|
| 117 |
+
}
|
| 118 |
+
});
|
| 119 |
+
$('#relpoststh_output_style').change(function() {
|
| 120 |
if (this.value == 'list') {
|
| 121 |
$('#relpoststh_cleanhtml').show();
|
| 122 |
} else {
|
inc/rpt-settings.php
CHANGED
|
@@ -36,16 +36,20 @@ if ( isset( $_POST[ 'action' ] ) && ( $_POST[ 'action' ] == 'update' ) ) {
|
|
| 36 |
update_option( 'relpoststh_onlywiththumbs', '0' );
|
| 37 |
}
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
|
| 45 |
if ( isset( $_POST[ 'relpoststh_output_style' ] ) ) {
|
| 46 |
update_option( 'relpoststh_output_style', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_output_style' ] ) ) );
|
| 47 |
}
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
if ( isset( $_POST[ 'relpoststh_cleanhtml' ] ) ) {
|
| 50 |
update_option( 'relpoststh_cleanhtml', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_cleanhtml' ] ) ) );
|
| 51 |
} else {
|
|
@@ -231,22 +235,36 @@ $relpoststh_mobile_view = get_option( 'relpoststh_mobile_view' );
|
|
| 231 |
$relpoststh_show_categories = get_option( 'relpoststh_show_categories', get_option( 'relpoststh_categories' ) );
|
| 232 |
$relpoststh_show_categoriesall = get_option( 'relpoststh_show_categoriesall', $relpoststh_categoriesall );
|
| 233 |
$onlywiththumbs = get_option( 'relpoststh_onlywiththumbs', false );
|
|
|
|
|
|
|
| 234 |
$relpoststh_startdate = explode( '-', get_option( 'relpoststh_startdate' ) );
|
| 235 |
$relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
|
| 236 |
$thsources = array( 'post-thumbnails' => __( 'Post thumbnails', 'related_posts_thumbnails' ),'custom-field' => __( 'Custom field', 'related_posts_thumbnails' ) );
|
| 237 |
$categories = get_categories();
|
| 238 |
|
| 239 |
if ( $this->wp_version >= 3 ) {
|
| 240 |
-
|
| 241 |
} else {
|
| 242 |
-
|
| 243 |
}
|
| 244 |
|
| 245 |
$relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
|
| 246 |
|
| 247 |
-
$output_styles
|
| 248 |
-
'
|
| 249 |
-
'list' => __( 'List', 'related-posts-thumbnails' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
$relation_options = array(
|
| 252 |
'categories' => __( 'Categories', 'related-posts-thumbnails' ),
|
|
@@ -551,6 +569,43 @@ if ( $this->wp_version >= 3 ) {
|
|
| 551 |
</div>
|
| 552 |
</td>
|
| 553 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 554 |
<!-- </table> -->
|
| 555 |
</table>
|
| 556 |
</div>
|
| 36 |
update_option( 'relpoststh_onlywiththumbs', '0' );
|
| 37 |
}
|
| 38 |
|
| 39 |
+
if ( isset( $_POST[ 'relpoststh_show_date' ] ) ) {
|
| 40 |
+
update_option( 'relpoststh_show_date', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_show_date' ] ) ) );
|
| 41 |
+
} else {
|
| 42 |
+
update_option( 'relpoststh_show_date', '0' );
|
| 43 |
+
}
|
| 44 |
|
| 45 |
if ( isset( $_POST[ 'relpoststh_output_style' ] ) ) {
|
| 46 |
update_option( 'relpoststh_output_style', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_output_style' ] ) ) );
|
| 47 |
}
|
| 48 |
|
| 49 |
+
if ( isset( $_POST[ 'relpoststh_date_format' ] ) ) {
|
| 50 |
+
update_option( 'relpoststh_date_format', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_date_format' ] ) ) );
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
if ( isset( $_POST[ 'relpoststh_cleanhtml' ] ) ) {
|
| 54 |
update_option( 'relpoststh_cleanhtml', sanitize_text_field( wp_unslash( $_POST[ 'relpoststh_cleanhtml' ] ) ) );
|
| 55 |
} else {
|
| 235 |
$relpoststh_show_categories = get_option( 'relpoststh_show_categories', get_option( 'relpoststh_categories' ) );
|
| 236 |
$relpoststh_show_categoriesall = get_option( 'relpoststh_show_categoriesall', $relpoststh_categoriesall );
|
| 237 |
$onlywiththumbs = get_option( 'relpoststh_onlywiththumbs', false );
|
| 238 |
+
$relpoststh_show_date = get_option( 'relpoststh_show_date', false );
|
| 239 |
+
$relpoststh_date_format = get_option( 'relpoststh_date_format', false );
|
| 240 |
$relpoststh_startdate = explode( '-', get_option( 'relpoststh_startdate' ) );
|
| 241 |
$relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
|
| 242 |
$thsources = array( 'post-thumbnails' => __( 'Post thumbnails', 'related_posts_thumbnails' ),'custom-field' => __( 'Custom field', 'related_posts_thumbnails' ) );
|
| 243 |
$categories = get_categories();
|
| 244 |
|
| 245 |
if ( $this->wp_version >= 3 ) {
|
| 246 |
+
$post_types = get_post_types( array( 'public' => 1 ) );
|
| 247 |
} else {
|
| 248 |
+
$post_types = get_post_types();
|
| 249 |
}
|
| 250 |
|
| 251 |
$relpoststh_post_types = get_option( 'relpoststh_post_types', $this->post_types );
|
| 252 |
|
| 253 |
+
$output_styles = array(
|
| 254 |
+
'' => __( 'Blocks', 'related-posts-thumbnails' ),
|
| 255 |
+
'list' => __( 'List', 'related-posts-thumbnails' ),
|
| 256 |
+
);
|
| 257 |
+
|
| 258 |
+
$rpt_date_format = array(
|
| 259 |
+
'F j, Y' => date( 'F j, Y' ),
|
| 260 |
+
'l F j, Y' => date( 'l F j, Y' ),
|
| 261 |
+
'Y-m-d' => date( 'Y-m-d' ),
|
| 262 |
+
'm/d/Y' => date( 'm/d/Y' ),
|
| 263 |
+
'dS M Y' => date( 'dS M Y' ),
|
| 264 |
+
'l F j, Y' => date( 'l F j, Y' ),
|
| 265 |
+
'F j, Y, g:i' => date( 'F j, Y, g:i' ),
|
| 266 |
+
'F j, Y, g:i a' => date( 'F j, Y, g:i a' ),
|
| 267 |
+
);
|
| 268 |
|
| 269 |
$relation_options = array(
|
| 270 |
'categories' => __( 'Categories', 'related-posts-thumbnails' ),
|
| 569 |
</div>
|
| 570 |
</td>
|
| 571 |
</tr>
|
| 572 |
+
<tr>
|
| 573 |
+
<th scope="row">
|
| 574 |
+
<?php _e( 'Show date', 'related-posts-thumbnails' ); ?>:
|
| 575 |
+
</th>
|
| 576 |
+
<td>
|
| 577 |
+
<input type="checkbox" name="relpoststh_show_date" id="relpoststh_show_date" value="1" <?php if ( $relpoststh_show_date ) { echo 'checked="checked"'; } ?> />
|
| 578 |
+
<label for="relpoststh_show_date">
|
| 579 |
+
<p class="description rpth-discription">
|
| 580 |
+
<?php _e( 'Show date on Related Post Thumbnails', 'related-posts-thumbnails' ); ?>
|
| 581 |
+
</p>
|
| 582 |
+
</label>
|
| 583 |
+
<br />
|
| 584 |
+
</td>
|
| 585 |
+
</tr>
|
| 586 |
+
|
| 587 |
+
<tr class="relpoststh_date_format" style="display:
|
| 588 |
+
<?php
|
| 589 |
+
if ( $relpoststh_show_date == '1' ) {
|
| 590 |
+
echo 'table-row';
|
| 591 |
+
} else {
|
| 592 |
+
echo 'none';
|
| 593 |
+
} ?> ;">
|
| 594 |
+
<th scope="row"><?php
|
| 595 |
+
_e( 'Date format', 'related-posts-thumbnails' ); ?>:
|
| 596 |
+
</th>
|
| 597 |
+
<td>
|
| 598 |
+
<select name="relpoststh_date_format" id="relpoststh_date_format">
|
| 599 |
+
<?php foreach ( $rpt_date_format as $date => $date_format ): ?>
|
| 600 |
+
<option value="<?php echo $date; ?>"
|
| 601 |
+
<?php if ( $relpoststh_date_format == $date ) { echo 'selected'; } ?> >
|
| 602 |
+
<?php echo $date_format; ?>
|
| 603 |
+
</option>
|
| 604 |
+
<?php
|
| 605 |
+
endforeach; ?>
|
| 606 |
+
</select>
|
| 607 |
+
</td>
|
| 608 |
+
</tr>
|
| 609 |
<!-- </table> -->
|
| 610 |
</table>
|
| 611 |
</div>
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ 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:
|
| 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 |
-
=
|
| 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.
|
| 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: 2.0.0
|
| 8 |
License: GPLv3 or later
|
| 9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 10 |
|
| 71 |
|
| 72 |
== Upgrade Notice ==
|
| 73 |
|
| 74 |
+
= 2.0.0 =
|
| 75 |
* Please upgrade immediately.
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
| 79 |
+
= 2.0.0 - 2022-03-22 =
|
| 80 |
+
* New Feature: Introducing date feature with 7 type of date format.
|
| 81 |
+
* Enhancement: Added a filter `rpt_custom_relationship` to get posts from multiple custom post types with same term slug.
|
| 82 |
+
* Compatibility : Compatible with WordPress 5.9.2
|
| 83 |
+
|
| 84 |
= 1.9.2 - 2022-02-18 =
|
| 85 |
* Bugfix: Border style issue.
|
| 86 |
* Enhancement: Added a filter `relpost_anchor_attr` to extend the HTML attributes within the related posts thumbnails anchor tag.
|
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:
|
| 7 |
* Author: WPBrigade
|
| 8 |
* Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
|
| 9 |
*/
|
|
@@ -24,31 +24,34 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 24 |
GNU General Public License for more details.
|
| 25 |
*/
|
| 26 |
class RelatedPostsThumbnails {
|
| 27 |
-
/* Default values.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
public $
|
| 31 |
-
public $
|
| 32 |
-
public $
|
| 33 |
-
public $
|
| 34 |
-
public $
|
| 35 |
-
public $
|
| 36 |
-
public $
|
| 37 |
-
public $
|
| 38 |
-
public $
|
| 39 |
-
public $
|
| 40 |
-
public $
|
| 41 |
-
public $
|
| 42 |
-
public $
|
| 43 |
-
public $
|
| 44 |
-
public $
|
| 45 |
-
public $
|
| 46 |
-
public $
|
| 47 |
-
public $
|
| 48 |
-
public $
|
| 49 |
-
public $
|
| 50 |
-
public $
|
| 51 |
-
public $
|
|
|
|
|
|
|
|
|
|
| 52 |
protected $wp_kses_rp_args = array( 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'strong' => array() );
|
| 53 |
|
| 54 |
/**
|
|
@@ -586,16 +589,30 @@ class RelatedPostsThumbnails {
|
|
| 586 |
}
|
| 587 |
}
|
| 588 |
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
|
| 595 |
// $query = "SELECT distinct ID FROM $wpdb->posts ";
|
| 596 |
$query = "SELECT ID FROM $wpdb->posts ";
|
| 597 |
-
$where = " WHERE post_type = '" . $post_type . "' AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
| 598 |
-
|
| 599 |
$startdate = get_option( 'relpoststh_startdate' );
|
| 600 |
|
| 601 |
if ( !empty( $startdate ) && preg_match( '/^\d\d\d\d-\d\d-\d\d$/', $startdate ) ) { // If startdate was set
|
|
@@ -719,6 +736,9 @@ class RelatedPostsThumbnails {
|
|
| 719 |
}
|
| 720 |
|
| 721 |
$relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
|
|
|
|
|
|
|
|
|
|
| 722 |
$relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
|
| 723 |
$text_height = get_option( 'relpoststh_textblockheight', $this->text_block_height );
|
| 724 |
|
|
@@ -884,6 +904,19 @@ class RelatedPostsThumbnails {
|
|
| 884 |
$output .= '<a href="' . get_permalink( $post->ID ) . '" class="relpost_content" font-family: ' . $fontface . '>';
|
| 885 |
$output .= '<span class="rpth_amp_list_content">' . $title . $excerpt . '</span>' . $after_content . '</a></li>';
|
| 886 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 887 |
if ( $relpoststh_output_style == 'list' ) {
|
| 888 |
$link = get_permalink( $post->ID );
|
| 889 |
$output .= '<li ';
|
|
@@ -893,7 +926,7 @@ class RelatedPostsThumbnails {
|
|
| 893 |
// }
|
| 894 |
|
| 895 |
$output .= '>';
|
| 896 |
-
$output .= '<a href="' . $link . '" ><img class="relpost-post-image" alt="' . $alt . '" src="' . esc_url( $url ) . '" width="' . $width . '" height="' . $height . '" ';
|
| 897 |
|
| 898 |
// if ( !$relpoststh_cleanhtml ) {
|
| 899 |
// $output .= 'style="padding: 0px; margin: 0px; border: 0pt none;"';
|
|
@@ -908,12 +941,13 @@ class RelatedPostsThumbnails {
|
|
| 908 |
$output .= ' style="width: ' . $width . 'px;height: ' . $text_height . 'px; font-family: ' . $fontface . '; "';
|
| 909 |
}
|
| 910 |
|
|
|
|
| 911 |
// $output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $date . '</a></li>';
|
| 912 |
-
$output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $after_content . '</a></li>';
|
| 913 |
}
|
| 914 |
} else {
|
| 915 |
//if lazy-load is not activated
|
| 916 |
-
$rpt_single_background = apply_filters( 'rpt-single-background', 'background: transparent url(' .
|
| 917 |
|
| 918 |
//if lazy-load is activated
|
| 919 |
$rpt_lazy_single_background = apply_filters( 'rpt-lazy-loading', false );
|
|
@@ -972,13 +1006,12 @@ class RelatedPostsThumbnails {
|
|
| 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 ) {
|
| 977 |
-
$output .= '<img loading="lazy" class="relpost-block-single-image" alt="' . $alt . '" src="'. $url . '"
|
| 978 |
} else {
|
| 979 |
-
$output .= '<div class="relpost-block-single-image" alt="' . $alt . '"
|
| 980 |
}
|
| 981 |
-
$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>';
|
| 982 |
$output .= $after_content;
|
| 983 |
// $output .= $date;
|
| 984 |
$output .= '</div>';
|
| 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: 2.0.0
|
| 7 |
* Author: WPBrigade
|
| 8 |
* Author URI: https://WPBrigade.com/?utm_source=related-posts-lite&utm_medium=author-link&utm_campaign=pro-upgrade-rp
|
| 9 |
*/
|
| 24 |
GNU General Public License for more details.
|
| 25 |
*/
|
| 26 |
class RelatedPostsThumbnails {
|
| 27 |
+
/* Default values.
|
| 28 |
+
* PHP 8.0 compatible
|
| 29 |
+
* */
|
| 30 |
+
public $single_only = '1';
|
| 31 |
+
public $auto = '1';
|
| 32 |
+
public $top_text = '<h3>Related posts:</h3>';
|
| 33 |
+
public $number = 3;
|
| 34 |
+
public $relation = 'categories';
|
| 35 |
+
public $poststhname = 'thumbnail';
|
| 36 |
+
public $background = '#ffffff';
|
| 37 |
+
public $hoverbackground = '#eeeeee';
|
| 38 |
+
public $border_color = '#dddddd';
|
| 39 |
+
public $font_color = '#333333';
|
| 40 |
+
public $font_family = 'Arial';
|
| 41 |
+
public $font_size = '12';
|
| 42 |
+
public $text_length = '100';
|
| 43 |
+
public $excerpt_length = '0';
|
| 44 |
+
public $custom_field = '';
|
| 45 |
+
public $custom_height = '100';
|
| 46 |
+
public $custom_width = '100';
|
| 47 |
+
public $text_block_height = '75';
|
| 48 |
+
public $thsource = 'post-thumbnails';
|
| 49 |
+
public $categories_all = '1';
|
| 50 |
+
public $devmode = '0';
|
| 51 |
+
public $format = 'j F, Y';
|
| 52 |
+
public $output_style = 'div';
|
| 53 |
+
public $post_types = array( 'post' );
|
| 54 |
+
public $custom_taxonomies = array();
|
| 55 |
protected $wp_kses_rp_args = array( 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), 'strong' => array() );
|
| 56 |
|
| 57 |
/**
|
| 589 |
}
|
| 590 |
}
|
| 591 |
|
| 592 |
+
$selected_post_type = '';
|
| 593 |
+
/**
|
| 594 |
+
* Filter the post type to get posts from multiple Custom post types
|
| 595 |
+
*
|
| 596 |
+
* @since 1.9.3
|
| 597 |
+
*/
|
| 598 |
+
$custom_relations = apply_filters( 'rpt_custom_relationship', array( get_post_type() ) );
|
| 599 |
+
|
| 600 |
+
if ( ! is_array( $custom_relations ) ) {
|
| 601 |
+
$custom_relations = array( $custom_relations );
|
| 602 |
+
}
|
| 603 |
+
|
| 604 |
+
foreach( $custom_relations as $checked_post_type ) {
|
| 605 |
+
if ( in_array( $checked_post_type, get_post_types() ) ) {
|
| 606 |
+
$selected_post_type .= "'" . esc_html( $checked_post_type ) . "',";
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
$checked_post_type = rtrim( $selected_post_type, ',' );
|
| 611 |
|
| 612 |
// $query = "SELECT distinct ID FROM $wpdb->posts ";
|
| 613 |
$query = "SELECT ID FROM $wpdb->posts ";
|
| 614 |
+
// $where = " WHERE post_type = '" . $post_type . "' AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
| 615 |
+
$where = " WHERE post_type IN (" . $checked_post_type . ") AND post_status = 'publish' AND ID<>" . $id; // not the current post
|
| 616 |
$startdate = get_option( 'relpoststh_startdate' );
|
| 617 |
|
| 618 |
if ( !empty( $startdate ) && preg_match( '/^\d\d\d\d-\d\d-\d\d$/', $startdate ) ) { // If startdate was set
|
| 736 |
}
|
| 737 |
|
| 738 |
$relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
|
| 739 |
+
$relpoststh_show_date = get_option( 'relpoststh_show_date', '0' );
|
| 740 |
+
$relpoststh_date_format = get_option( 'relpoststh_date_format', $this->format );
|
| 741 |
+
|
| 742 |
$relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
|
| 743 |
$text_height = get_option( 'relpoststh_textblockheight', $this->text_block_height );
|
| 744 |
|
| 904 |
$output .= '<a href="' . get_permalink( $post->ID ) . '" class="relpost_content" font-family: ' . $fontface . '>';
|
| 905 |
$output .= '<span class="rpth_amp_list_content">' . $title . $excerpt . '</span>' . $after_content . '</a></li>';
|
| 906 |
} else {
|
| 907 |
+
|
| 908 |
+
$date_output = '';
|
| 909 |
+
|
| 910 |
+
/**
|
| 911 |
+
* Get the date format from the settings.
|
| 912 |
+
*
|
| 913 |
+
* @since 1.9.3
|
| 914 |
+
*/
|
| 915 |
+
if ( '0' !== $relpoststh_show_date ) {
|
| 916 |
+
$date = get_the_date( $relpoststh_date_format, $post->ID );
|
| 917 |
+
$date_output = '<span class="rpth_list_date">' . $date . '</span>';
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
if ( $relpoststh_output_style == 'list' ) {
|
| 921 |
$link = get_permalink( $post->ID );
|
| 922 |
$output .= '<li ';
|
| 926 |
// }
|
| 927 |
|
| 928 |
$output .= '>';
|
| 929 |
+
$output .= '<a href="' . $link . '" ><img class="relpost-post-image" alt="' . esc_attr( $alt ) . '" src="' . esc_url( $url ) . '" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" ';
|
| 930 |
|
| 931 |
// if ( !$relpoststh_cleanhtml ) {
|
| 932 |
// $output .= 'style="padding: 0px; margin: 0px; border: 0pt none;"';
|
| 941 |
$output .= ' style="width: ' . $width . 'px;height: ' . $text_height . 'px; font-family: ' . $fontface . '; "';
|
| 942 |
}
|
| 943 |
|
| 944 |
+
|
| 945 |
// $output .= '><span class="rpth_list_content">' . $title . $excerpt . '</span>' . $date . '</a></li>';
|
| 946 |
+
$output .= '><span class="rpth_list_content">' . $title . $excerpt . $date_output . '</span>' . $after_content . '</a></li>';
|
| 947 |
}
|
| 948 |
} else {
|
| 949 |
//if lazy-load is not activated
|
| 950 |
+
$rpt_single_background = apply_filters( 'rpt-single-background', 'background: transparent url(' . $url . ') no-repeat scroll 0% 0%; width: ' . $width . 'px; height: ' . $height . 'px;' );
|
| 951 |
|
| 952 |
//if lazy-load is activated
|
| 953 |
$rpt_lazy_single_background = apply_filters( 'rpt-lazy-loading', false );
|
| 1006 |
$output .= '<a href="' . get_permalink( $post->ID ) . '"' . $relpost_attributes . '>';
|
| 1007 |
|
| 1008 |
$output .= '<div class="relpost-custom-block-single" style="width: ' . $width . 'px; height: ' . ( $height + $text_height ) . 'px;">';
|
|
|
|
| 1009 |
if( $rpt_lazy_single_background ) {
|
| 1010 |
+
$output .= '<img loading="lazy" class="relpost-block-single-image" alt="' . esc_attr( $alt ) . '" src="'. esc_url( $url ) . '">' . $date_output . '</img>';
|
| 1011 |
} else {
|
| 1012 |
+
$output .= '<div class="relpost-block-single-image" alt="' . esc_attr( $alt ) . '" style="'. esc_attr( $rpt_single_background ) . '"></div>';
|
| 1013 |
}
|
| 1014 |
+
$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 . $date_output . '</div>';
|
| 1015 |
$output .= $after_content;
|
| 1016 |
// $output .= $date;
|
| 1017 |
$output .= '</div>';
|
