Version Description
(06-May-2021) = * New: Option to automatically generate missing thumbnail sizes on the fly * New: Option to include or exclude Sticky Posts * Enhancement: Dynamic CSS for the built-in "Thumbnails" theme is now in-lined for much improved cross compatibility with optimization and caching plugins * Bugfix: Fixes conflict with the Page Optimize plugin
Download this release
Release Info
Developer | jeffparker |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 5.20.0 |
Comparing to | |
See all releases |
Code changes from version 5.19.0 to 5.20.0
- classes/YARPP_Block.php +1 -2
- classes/YARPP_Cache.php +11 -5
- classes/YARPP_Core.php +20 -14
- classes/YARPP_Meta_Box.php +1 -1
- classes/YARPP_Meta_Box_Display_Web.php +9 -1
- includes/phtmls/yarpp_meta_box_checkbox.phtml +11 -3
- includes/phtmls/yarpp_meta_box_pool.phtml +2 -2
- includes/styles_thumbnails.css.php +0 -56
- includes/template_functions.php +49 -0
- includes/yarpp_options.php +2 -1
- readme.txt +8 -2
- style/options_basic.css +1 -1
- style/styles_thumbnails.css +21 -0
- yarpp.php +2 -2
classes/YARPP_Block.php
CHANGED
@@ -20,8 +20,7 @@ if ( ! class_exists( 'YARPP_Block', false ) && function_exists( 'register_block_
|
|
20 |
add_action( 'init', array( $this, 'yarpp_gutenberg_block_func' ), 100 );
|
21 |
add_filter( 'block_categories', array( $this, 'yarpp_block_categories' ), 10, 2 );
|
22 |
add_action( 'enqueue_block_editor_assets', array( $this, 'yarpp_enqueue_block_editor_assets' ) );
|
23 |
-
}
|
24 |
-
/**
|
25 |
* YARPP enqueue thumbnail stylesheet.
|
26 |
*/
|
27 |
public function yarpp_enqueue_block_editor_assets() {
|
20 |
add_action( 'init', array( $this, 'yarpp_gutenberg_block_func' ), 100 );
|
21 |
add_filter( 'block_categories', array( $this, 'yarpp_block_categories' ), 10, 2 );
|
22 |
add_action( 'enqueue_block_editor_assets', array( $this, 'yarpp_enqueue_block_editor_assets' ) );
|
23 |
+
}/**
|
|
|
24 |
* YARPP enqueue thumbnail stylesheet.
|
25 |
*/
|
26 |
public function yarpp_enqueue_block_editor_assets() {
|
classes/YARPP_Cache.php
CHANGED
@@ -220,10 +220,7 @@ abstract class YARPP_Cache {
|
|
220 |
* Where
|
221 |
*/
|
222 |
|
223 |
-
$newsql .=
|
224 |
-
" where post_status in ( 'publish', 'static' ) and ID != %d",
|
225 |
-
$reference_ID
|
226 |
-
);
|
227 |
/**
|
228 |
* @since 3.1.8 Revised $past_only option
|
229 |
*/
|
@@ -267,7 +264,16 @@ abstract class YARPP_Cache {
|
|
267 |
$post_types
|
268 |
);
|
269 |
$newsql .= ' and post_type IN (' . implode(',',$sanitized_post_types). ')';
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
// GROUP BY
|
272 |
$newsql .= "\n group by ID \n";
|
273 |
|
220 |
* Where
|
221 |
*/
|
222 |
|
223 |
+
$newsql .= " where post_status in ( 'publish', 'static' )";
|
|
|
|
|
|
|
224 |
/**
|
225 |
* @since 3.1.8 Revised $past_only option
|
226 |
*/
|
264 |
$post_types
|
265 |
);
|
266 |
$newsql .= ' and post_type IN (' . implode(',',$sanitized_post_types). ')';
|
267 |
+
$post_ids_to_exclude = array( ( int )$reference_ID);
|
268 |
+
$include_sticky_posts = $this->core->get_option( 'include_sticky_posts' );
|
269 |
+
if ( 1 !== (int) $include_sticky_posts ) {
|
270 |
+
$get_sticky_posts = get_option( 'sticky_posts' );
|
271 |
+
$post_ids_to_exclude = wp_parse_args( $get_sticky_posts, $post_ids_to_exclude );
|
272 |
+
}
|
273 |
+
// Allow to filter the exluded post ids.
|
274 |
+
$post_ids_to_exclude = apply_filters( 'yarpp_post_ids_to_exclude', $post_ids_to_exclude, $reference_ID );
|
275 |
+
$post__not_in = implode( ',', array_map( 'absint', $post_ids_to_exclude ) );
|
276 |
+
$newsql .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
|
277 |
// GROUP BY
|
278 |
$newsql .= "\n group by ID \n";
|
279 |
|
classes/YARPP_Core.php
CHANGED
@@ -194,6 +194,8 @@ class YARPP {
|
|
194 |
'rss_template' => false,
|
195 |
'show_pass_post' => false,
|
196 |
'cross_relate' => false,
|
|
|
|
|
197 |
'rss_display' => false,
|
198 |
'rss_excerpt_display' => true,
|
199 |
'promote_yarpp' => false,
|
@@ -244,7 +246,7 @@ class YARPP {
|
|
244 |
$this->db_options->set_yarpp_options($new_options);
|
245 |
|
246 |
// new in 3.1: clear cache when updating certain settings.
|
247 |
-
$clear_cache_options = array('show_pass_post' => 1, 'recent' => 1, 'threshold' => 1, 'past_only' => 1);
|
248 |
|
249 |
$relevant_options = array_intersect_key($options, $clear_cache_options);
|
250 |
$relevant_current_options = array_intersect_key($current_options, $clear_cache_options);
|
@@ -514,7 +516,7 @@ class YARPP {
|
|
514 |
}
|
515 |
|
516 |
public function diagnostic_generate_thumbnails() {
|
517 |
-
return (defined('YARPP_GENERATE_THUMBNAILS') && YARPP_GENERATE_THUMBNAILS);
|
518 |
}
|
519 |
|
520 |
public function diagnostic_using_thumbnails() {
|
@@ -588,16 +590,20 @@ class YARPP {
|
|
588 |
/**
|
589 |
* @param $dimensions
|
590 |
*/
|
591 |
-
public function enqueue_thumbnails_stylesheet($dimensions) {
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
|
|
|
|
|
|
|
|
601 |
}
|
602 |
|
603 |
/*
|
@@ -1039,13 +1045,13 @@ class YARPP {
|
|
1039 |
|
1040 |
$comments = wp_count_comments();
|
1041 |
$users = $wpdb->get_var("SELECT COUNT(ID) FROM ".$wpdb->users); //count_users();
|
1042 |
-
|
1043 |
$settings = $this->get_option();
|
1044 |
|
1045 |
$collect = array_flip(array(
|
1046 |
'threshold', 'limit', 'excerpt_length', 'recent', 'rss_limit',
|
1047 |
'rss_excerpt_length', 'past_only', 'show_excerpt', 'rss_show_excerpt',
|
1048 |
-
'template', 'rss_template', 'show_pass_post', 'cross_relate',
|
1049 |
'rss_display', 'rss_excerpt_display', 'promote_yarpp', 'rss_promote_yarpp',
|
1050 |
'myisam_override', 'weight', 'require_tax', 'auto_display_archive', 'exclude'
|
1051 |
));
|
194 |
'rss_template' => false,
|
195 |
'show_pass_post' => false,
|
196 |
'cross_relate' => false,
|
197 |
+
'include_sticky_posts' => true,
|
198 |
+
'generate_missing_thumbnails' => false,
|
199 |
'rss_display' => false,
|
200 |
'rss_excerpt_display' => true,
|
201 |
'promote_yarpp' => false,
|
246 |
$this->db_options->set_yarpp_options($new_options);
|
247 |
|
248 |
// new in 3.1: clear cache when updating certain settings.
|
249 |
+
$clear_cache_options = array('show_pass_post' => 1, 'recent' => 1, 'threshold' => 1, 'past_only' => 1, 'include_sticky_posts' => 1);
|
250 |
|
251 |
$relevant_options = array_intersect_key($options, $clear_cache_options);
|
252 |
$relevant_current_options = array_intersect_key($current_options, $clear_cache_options);
|
516 |
}
|
517 |
|
518 |
public function diagnostic_generate_thumbnails() {
|
519 |
+
return (defined( 'YARPP_GENERATE_THUMBNAILS' ) && YARPP_GENERATE_THUMBNAILS) || (bool) $this->get_option( 'generate_missing_thumbnails' );
|
520 |
}
|
521 |
|
522 |
public function diagnostic_using_thumbnails() {
|
590 |
/**
|
591 |
* @param $dimensions
|
592 |
*/
|
593 |
+
public function enqueue_thumbnails_stylesheet( $dimensions ) {
|
594 |
+
|
595 |
+
wp_register_style('yarpp-thumbnails', plugins_url('/style/styles_thumbnails.css', YARPP_MAIN_FILE ), array(), YARPP_VERSION);
|
596 |
+
/**
|
597 |
+
* Filter to allow dequeing of styles_thumbnails.css.
|
598 |
+
*
|
599 |
+
* @param boolean default true
|
600 |
+
*/
|
601 |
+
$enqueue_yarpp_thumbnails = apply_filters( 'yarpp_enqueue_thumbnails_style', true );
|
602 |
+
if ( true === $enqueue_yarpp_thumbnails ) {
|
603 |
+
$yarpp_custom_css = yarpp_thumbnail_inline_css( $dimensions );
|
604 |
+
wp_enqueue_style( 'yarpp-thumbnails' );
|
605 |
+
wp_add_inline_style( 'yarpp-thumbnails', $yarpp_custom_css );
|
606 |
+
}
|
607 |
}
|
608 |
|
609 |
/*
|
1045 |
|
1046 |
$comments = wp_count_comments();
|
1047 |
$users = $wpdb->get_var("SELECT COUNT(ID) FROM ".$wpdb->users); //count_users();
|
1048 |
+
$posts = $wpdb->get_var("SELECT COUNT(ID) FROM ".$wpdb->posts." WHERE post_type = 'post' AND comment_count > 0");
|
1049 |
$settings = $this->get_option();
|
1050 |
|
1051 |
$collect = array_flip(array(
|
1052 |
'threshold', 'limit', 'excerpt_length', 'recent', 'rss_limit',
|
1053 |
'rss_excerpt_length', 'past_only', 'show_excerpt', 'rss_show_excerpt',
|
1054 |
+
'template', 'rss_template', 'show_pass_post', 'cross_relate', 'generate_missing_thumbnails', 'include_sticky_posts',
|
1055 |
'rss_display', 'rss_excerpt_display', 'promote_yarpp', 'rss_promote_yarpp',
|
1056 |
'myisam_override', 'weight', 'require_tax', 'auto_display_archive', 'exclude'
|
1057 |
));
|
classes/YARPP_Meta_Box.php
CHANGED
@@ -22,7 +22,7 @@ class YARPP_Meta_Box {
|
|
22 |
return (!$this->yarpp->diagnostic_custom_templates() && $this->yarpp->admin->can_copy_templates());
|
23 |
}
|
24 |
|
25 |
-
public function checkbox($option, $desc, $class = null) {
|
26 |
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_checkbox.phtml');
|
27 |
}
|
28 |
|
22 |
return (!$this->yarpp->diagnostic_custom_templates() && $this->yarpp->admin->can_copy_templates());
|
23 |
}
|
24 |
|
25 |
+
public function checkbox($option, $desc, $class = null, $yarpp_args = array()) {
|
26 |
include(YARPP_DIR.'/includes/phtmls/yarpp_meta_box_checkbox.phtml');
|
27 |
}
|
28 |
|
classes/YARPP_Meta_Box_Display_Web.php
CHANGED
@@ -74,8 +74,16 @@ class YARPP_Meta_Box_Display_Web extends YARPP_Meta_Box {
|
|
74 |
$this->radio( 'thumbnail_size_display', $name, '', $key );
|
75 |
}
|
76 |
echo '</div></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
echo "</div>";
|
78 |
-
|
79 |
echo "<div class='yarpp_subbox template_options_builtin'";
|
80 |
if ( $choice != 'builtin' )
|
81 |
echo ' style="display: none;"';
|
74 |
$this->radio( 'thumbnail_size_display', $name, '', $key );
|
75 |
}
|
76 |
echo '</div></div>';
|
77 |
+
$disabled_checkbox = '';
|
78 |
+
$generate_missing_thumbnails = yarpp_get_option( 'generate_missing_thumbnails' );
|
79 |
+
if ( defined( 'YARPP_GENERATE_THUMBNAILS' ) ) {
|
80 |
+
$disabled_checkbox = 'disabled';
|
81 |
+
$generate_missing_thumbnails = YARPP_GENERATE_THUMBNAILS;
|
82 |
+
}
|
83 |
+
$yarpp_args = array( 'template_type' => 'right-aligned-checkbox', 'disabled_checkbox' => $disabled_checkbox, 'option_value' => $generate_missing_thumbnails );
|
84 |
+
$this->checkbox( 'generate_missing_thumbnails', __( "Generate missing thumbnail sizes: ", 'yarpp' ) . "<span class='yarpp_help dashicons dashicons-editor-help' data-help='" . "<p>" . esc_attr( __( "When enabled, missing thumbnail sizes will be automatically generated on the fly. Doing this type of processing on the fly may not scale well for larger sites.", 'yarpp' ) ) . "</p><p>" . sprintf( __( 'For larger sites, we recommend the %1$s or %2$s to generate missing thumbnail sizes in a batch process.', 'yarpp' ), '<a href="https://wordpress.org/plugins/regenerate-thumbnails/" target="_blank">Regenerate Thumbnails plugin</a>', '<a href="https://developer.wordpress.org/cli/commands/media/regenerate/" target="_blank">WP-CLI</a>' ) . "</p><p>" . esc_attr( __( "New images should continue to automatically get all active thumbnail sizes generated when they are uploaded.", 'yarpp' ) ) . "</p>" . "'> </span> ", 'yarpp', $yarpp_args );
|
85 |
echo "</div>";
|
86 |
+
|
87 |
echo "<div class='yarpp_subbox template_options_builtin'";
|
88 |
if ( $choice != 'builtin' )
|
89 |
echo ' style="display: none;"';
|
includes/phtmls/yarpp_meta_box_checkbox.phtml
CHANGED
@@ -1,12 +1,20 @@
|
|
1 |
<div class="yarpp_form_row yarpp_form_checkbox <?php echo $class ?>">
|
|
|
|
|
|
|
|
|
|
|
2 |
<div scope="row">
|
3 |
<input
|
4 |
type="checkbox"
|
5 |
name="<?php echo $option ?>"
|
6 |
id="yarpp-<?php echo $option ?>"
|
7 |
value="true"
|
8 |
-
<?php checked(yarpp_get_option($option)) ?>
|
|
|
9 |
/>
|
10 |
-
|
|
|
|
|
11 |
</div>
|
12 |
-
</div>
|
1 |
<div class="yarpp_form_row yarpp_form_checkbox <?php echo $class ?>">
|
2 |
+
<?php if( isset( $yarpp_args['template_type'] ) && 'right-aligned-checkbox' === $yarpp_args['template_type'] ) { ?>
|
3 |
+
<div class="yarpp_form_label">
|
4 |
+
<?php echo $desc ?>
|
5 |
+
</div>
|
6 |
+
<?php } ?>
|
7 |
<div scope="row">
|
8 |
<input
|
9 |
type="checkbox"
|
10 |
name="<?php echo $option ?>"
|
11 |
id="yarpp-<?php echo $option ?>"
|
12 |
value="true"
|
13 |
+
<?php checked((isset($yarpp_args['option_value'])) ? $yarpp_args['option_value'] : yarpp_get_option($option)) ?>
|
14 |
+
<?php echo (isset($yarpp_args['disabled_checkbox'])) ? $yarpp_args['disabled_checkbox'] : '';?>
|
15 |
/>
|
16 |
+
<?php if ( ! isset( $yarpp_args['template_type'] ) || 'right-aligned-checkbox' !== $yarpp_args['template_type'] ) { ?>
|
17 |
+
<label for="yarpp-<?php echo $option ?>"><?php echo $desc ?></label>
|
18 |
+
<?php } ?>
|
19 |
</div>
|
20 |
+
</div>
|
includes/phtmls/yarpp_meta_box_pool.phtml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
}
|
14 |
|
15 |
$this->checkbox('show_pass_post', __('Display password protected posts', 'yarpp'));
|
16 |
-
|
17 |
$recent = yarpp_get_option('recent');
|
18 |
if ((bool) $recent) {
|
19 |
list($recent_number, $recent_units) = explode(' ', $recent);
|
@@ -51,5 +51,5 @@ $recent_units_html .= '</select>';
|
|
51 |
<?php
|
52 |
$this->checkbox( 'past_only', __( "Display only posts older than current post", 'yarpp' )." <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( "Only posts older than the current post will be displayed.", 'yarpp' ) ) . "'> </span>" );
|
53 |
|
54 |
-
$this->checkbox( 'cross_relate', __( "Display results from all post types", 'yarpp' )." <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( "When disabled, only other posts with the same post type will be displayed. For example, only posts will be displayed as related to a post, only pages will be displayed as related to a page, etc.", 'yarpp' ) ) . "'> </span>" );
|
55 |
?>
|
13 |
}
|
14 |
|
15 |
$this->checkbox('show_pass_post', __('Display password protected posts', 'yarpp'));
|
16 |
+
$this->checkbox( 'include_sticky_posts', __( "Display sticky posts", 'yarpp' ) );
|
17 |
$recent = yarpp_get_option('recent');
|
18 |
if ((bool) $recent) {
|
19 |
list($recent_number, $recent_units) = explode(' ', $recent);
|
51 |
<?php
|
52 |
$this->checkbox( 'past_only', __( "Display only posts older than current post", 'yarpp' )." <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( "Only posts older than the current post will be displayed.", 'yarpp' ) ) . "'> </span>" );
|
53 |
|
54 |
+
$this->checkbox( 'cross_relate', __( "Display results from all post types", 'yarpp' )." <span class='yarpp_help dashicons dashicons-editor-help' data-help='" . esc_attr( __( "When disabled, only other posts with the same post type will be displayed. For example, only posts will be displayed as related to a post, only pages will be displayed as related to a page, etc.", 'yarpp' ) ) . "'> </span>" );
|
55 |
?>
|
includes/styles_thumbnails.css.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Dynamic styles for YARPP's built-in thumbnails template
|
4 |
-
* @since 4.0
|
5 |
-
*/
|
6 |
-
|
7 |
-
$height = (isset($_GET['height'])) ? (int) $_GET['height'] : 120;
|
8 |
-
$width = (isset($_GET['width'])) ? (int) $_GET['width'] : 120;
|
9 |
-
$margin = 5;
|
10 |
-
$width_with_margins = ($margin * 2) + $width;
|
11 |
-
$height_with_text = $height + 50;
|
12 |
-
$extra_margin = 7;
|
13 |
-
|
14 |
-
$seconds_to_cache = 604800; // 1 week
|
15 |
-
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
16 |
-
header("Expires: $ts");
|
17 |
-
header("Cache-Control: public, max-age=$seconds_to_cache");
|
18 |
-
header('Content-Type: text/css');
|
19 |
-
?>
|
20 |
-
.yarpp-thumbnails-horizontal .yarpp-thumbnail, .yarpp-thumbnail-default, .yarpp-thumbnail-title {
|
21 |
-
display: inline-block;
|
22 |
-
}
|
23 |
-
.yarpp-thumbnails-horizontal .yarpp-thumbnail {
|
24 |
-
border: 1px solid rgba(127,127,127,0.1);
|
25 |
-
width: <?php echo $width_with_margins; ?>px;
|
26 |
-
height: <?php echo $height_with_text; ?>px;
|
27 |
-
margin: <?php echo $margin; ?>px;
|
28 |
-
margin-left: 0px;
|
29 |
-
vertical-align: top;
|
30 |
-
}
|
31 |
-
.yarpp-thumbnail > img, .yarpp-thumbnail-default {
|
32 |
-
width: <?php echo $width; ?>px;
|
33 |
-
height: <?php echo $height; ?>px;
|
34 |
-
margin: <?php echo $margin; ?>px;
|
35 |
-
}
|
36 |
-
.yarpp-thumbnails-horizontal .yarpp-thumbnail > img, .yarpp-thumbnails-horizontal .yarpp-thumbnail-default {
|
37 |
-
display: block;
|
38 |
-
}
|
39 |
-
.yarpp-thumbnails-horizontal .yarpp-thumbnail-title {
|
40 |
-
font-size: 1em;
|
41 |
-
max-height: 2.8em;
|
42 |
-
line-height: 1.4em;
|
43 |
-
margin: <?php echo $extra_margin; ?>px;
|
44 |
-
margin-top: 0px;
|
45 |
-
width: <?php echo $width; ?>px;
|
46 |
-
text-decoration: inherit;
|
47 |
-
overflow: hidden;
|
48 |
-
}
|
49 |
-
|
50 |
-
.yarpp-thumbnail-default {
|
51 |
-
overflow: hidden;
|
52 |
-
}
|
53 |
-
.yarpp-thumbnail-default > img {
|
54 |
-
min-height: <?php echo $height; ?>px;
|
55 |
-
min-width: <?php echo $width; ?>px;
|
56 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/template_functions.php
CHANGED
@@ -12,3 +12,52 @@ function get_the_score() {
|
|
12 |
$score = $post->score;
|
13 |
return apply_filters('get_the_score', $score);
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
$score = $post->score;
|
13 |
return apply_filters('get_the_score', $score);
|
14 |
}
|
15 |
+
/**
|
16 |
+
* Get Dynamic styles for YARPP's built-in thumbnails template
|
17 |
+
*
|
18 |
+
* Return CSS for thumbnail sizes.
|
19 |
+
*
|
20 |
+
* @param array $dimension thumbnail dimension size.
|
21 |
+
* @return string
|
22 |
+
* @since 5.20.0
|
23 |
+
*/
|
24 |
+
function yarpp_thumbnail_inline_css( $dimension = array() ) {
|
25 |
+
$height = ( isset( $dimension['height'] ) ) ? (int) $dimension['height'] : 120;
|
26 |
+
$width = ( isset( $dimension['width'] ) ) ? (int) $dimension['width'] : 120;
|
27 |
+
$margin = 5;
|
28 |
+
$width_with_margins = ( $margin * 2 ) + $width;
|
29 |
+
$height_with_text = $height + 50;
|
30 |
+
$extra_margin = 7;
|
31 |
+
$yarpp_css = '';
|
32 |
+
$yarpp_css .= '.yarpp-thumbnails-horizontal .yarpp-thumbnail {';
|
33 |
+
$yarpp_css .= 'width: ' . $width_with_margins . 'px;';
|
34 |
+
$yarpp_css .= 'height: ' . $height_with_text . 'px;';
|
35 |
+
$yarpp_css .= 'margin: ' . $margin . 'px;';
|
36 |
+
$yarpp_css .= 'margin-left: 0px;';
|
37 |
+
$yarpp_css .= '}';
|
38 |
+
|
39 |
+
$yarpp_css .= '.yarpp-thumbnail > img, .yarpp-thumbnail-default {';
|
40 |
+
$yarpp_css .= 'width: ' . $width . 'px;';
|
41 |
+
$yarpp_css .= 'height: ' . $height . 'px;';
|
42 |
+
$yarpp_css .= 'margin: ' . $margin . 'px;';
|
43 |
+
$yarpp_css .= '}';
|
44 |
+
|
45 |
+
$yarpp_css .= '.yarpp-thumbnails-horizontal .yarpp-thumbnail-title {';
|
46 |
+
$yarpp_css .= 'margin: ' . $extra_margin . 'px;';
|
47 |
+
$yarpp_css .= 'margin-top: 0px;';
|
48 |
+
$yarpp_css .= 'width: ' . $width . 'px;';
|
49 |
+
$yarpp_css .= '}';
|
50 |
+
|
51 |
+
$yarpp_css .= '.yarpp-thumbnail-default > img {';
|
52 |
+
$yarpp_css .= 'min-height: ' . $height . 'px;';
|
53 |
+
$yarpp_css .= 'min-width: ' . $width . 'px;';
|
54 |
+
$yarpp_css .= '}';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Filter inline css.
|
58 |
+
*
|
59 |
+
* @param string $yarpp_css inline css.
|
60 |
+
*/
|
61 |
+
$yarpp_css = apply_filters( 'yarpp_filter_inline_style', $yarpp_css );
|
62 |
+
return $yarpp_css;
|
63 |
+
}
|
includes/yarpp_options.php
CHANGED
@@ -140,7 +140,8 @@ if (isset($_POST['update_yarpp']) && check_admin_referer('update_yarpp', 'update
|
|
140 |
else
|
141 |
$new_options['exclude'] = '';
|
142 |
|
143 |
-
$new_options['
|
|
|
144 |
( $_POST['use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
145 |
$new_options['rss_template'] = $_POST['rss_use_template'] == 'custom' ? $_POST['rss_template_file'] :
|
146 |
( $_POST['rss_use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
140 |
else
|
141 |
$new_options['exclude'] = '';
|
142 |
|
143 |
+
$new_options['include_sticky_posts'] = isset( $_POST['include_sticky_posts'] ) ? 1 : 0;
|
144 |
+
$new_options['template'] = $_POST['use_template'] == 'custom' ? $_POST['template_file'] :
|
145 |
( $_POST['use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
146 |
$new_options['rss_template'] = $_POST['rss_use_template'] == 'custom' ? $_POST['rss_template_file'] :
|
147 |
( $_POST['rss_use_template'] == 'thumbnails' ? 'thumbnails' : false );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Requires at least: 3.7
|
|
5 |
Requires PHP: 5.3
|
6 |
License: GPLv2 or later
|
7 |
Tested up to: 5.7
|
8 |
-
Stable tag: 5.
|
9 |
|
10 |
The most popular plugin to display a list of related posts on your site based on a powerful unique algorithm.
|
11 |
|
@@ -319,6 +319,12 @@ add_action(
|
|
319 |
`
|
320 |
|
321 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
= 5.19.0 (28-April-2021) =
|
323 |
* New: **YARPP Block** 🎉 now available for the WordPress Block Editor (Gutenberg) for drag and drop placement customization
|
324 |
* New: Choose image size for YARPP custom theme templates
|
@@ -1144,5 +1150,5 @@ After a break of many years, the plugin is 100% supported now that the baton has
|
|
1144 |
* Initial upload
|
1145 |
|
1146 |
== Upgrade Notice ==
|
1147 |
-
= 5.
|
1148 |
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!
|
5 |
Requires PHP: 5.3
|
6 |
License: GPLv2 or later
|
7 |
Tested up to: 5.7
|
8 |
+
Stable tag: 5.20.0
|
9 |
|
10 |
The most popular plugin to display a list of related posts on your site based on a powerful unique algorithm.
|
11 |
|
319 |
`
|
320 |
|
321 |
== Changelog ==
|
322 |
+
= 5.20.0 (06-May-2021) =
|
323 |
+
* New: Option to automatically generate missing thumbnail sizes on the fly
|
324 |
+
* New: Option to include or exclude Sticky Posts
|
325 |
+
* Enhancement: Dynamic CSS for the built-in "Thumbnails" theme is now in-lined for much improved cross compatibility with optimization and caching plugins
|
326 |
+
* [Bugfix](https://wordpress.org/support/topic/crashes-post-screen/): Fixes conflict with the [Page Optimize plugin](https://wordpress.org/plugins/page-optimize/)
|
327 |
+
|
328 |
= 5.19.0 (28-April-2021) =
|
329 |
* New: **YARPP Block** 🎉 now available for the WordPress Block Editor (Gutenberg) for drag and drop placement customization
|
330 |
* New: Choose image size for YARPP custom theme templates
|
1150 |
* Initial upload
|
1151 |
|
1152 |
== Upgrade Notice ==
|
1153 |
+
= 5.20.0 =
|
1154 |
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!
|
style/options_basic.css
CHANGED
@@ -406,4 +406,4 @@ body.rtl #yarpp-optin-learnmore {
|
|
406 |
box-shadow: none!important;
|
407 |
text-shadow: none!important;
|
408 |
cursor: not-allowed !important;
|
409 |
-
}
|
406 |
box-shadow: none!important;
|
407 |
text-shadow: none!important;
|
408 |
cursor: not-allowed !important;
|
409 |
+
}
|
style/styles_thumbnails.css
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.yarpp-thumbnails-horizontal .yarpp-thumbnail, .yarpp-thumbnail-default, .yarpp-thumbnail-title {
|
2 |
+
display: inline-block;
|
3 |
+
}
|
4 |
+
.yarpp-thumbnails-horizontal .yarpp-thumbnail {
|
5 |
+
border: 1px solid rgba(127,127,127,0.1);
|
6 |
+
vertical-align: top;
|
7 |
+
}
|
8 |
+
.yarpp-thumbnails-horizontal .yarpp-thumbnail > img, .yarpp-thumbnails-horizontal .yarpp-thumbnail-default {
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
.yarpp-thumbnails-horizontal .yarpp-thumbnail-title {
|
12 |
+
font-size: 1em;
|
13 |
+
max-height: 2.8em;
|
14 |
+
line-height: 1.4em;
|
15 |
+
text-decoration: inherit;
|
16 |
+
overflow: hidden;
|
17 |
+
}
|
18 |
+
|
19 |
+
.yarpp-thumbnail-default {
|
20 |
+
overflow: hidden;
|
21 |
+
}
|
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.
|
6 |
Author: YARPP
|
7 |
Author URI: https://yarpp.com/
|
8 |
Plugin URI: https://yarpp.com/
|
@@ -24,7 +24,7 @@ if(!defined('WP_CONTENT_DIR')){
|
|
24 |
define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
|
25 |
}
|
26 |
|
27 |
-
define('YARPP_VERSION', '5.
|
28 |
|
29 |
define('YARPP_DIR', dirname(__FILE__));
|
30 |
/**
|
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.20.0
|
6 |
Author: YARPP
|
7 |
Author URI: https://yarpp.com/
|
8 |
Plugin URI: https://yarpp.com/
|
24 |
define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
|
25 |
}
|
26 |
|
27 |
+
define('YARPP_VERSION', '5.20.0');
|
28 |
|
29 |
define('YARPP_DIR', dirname(__FILE__));
|
30 |
/**
|