Version Description
Download this release
Release Info
Developer | barrykooij |
Plugin | Related Posts for WordPress |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- assets/css/edit-post.css +1 -1
- assets/css/install.css +1 -1
- assets/css/scss/edit-post.scss +2 -2
- assets/js/edit-post.min.js +1 -1
- assets/js/install.min.js +1 -1
- assets/js/settings.min.js +1 -1
- classes/class-multisite-notice.php +2 -2
- classes/class-post-link-manager.php +41 -20
- classes/class-rp4wp.php +1 -1
- readme.txt +13 -1
- related-posts-for-wp.php +1 -1
assets/css/edit-post.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.rp4wp_table_manage.sortable tr{cursor:move}.rp4wp_table_manage.sortable tr td{background-position:98% 50%;background-image:url(
|
1 |
+
.rp4wp_table_manage.sortable tr{cursor:move}.rp4wp_table_manage.sortable tr td{background-position:98% 50%;background-image:url("../images/grabber.png");background-repeat:no-repeat}.rp4wp_table_manage td{padding-bottom:11px}.rp4wp_table_manage tr:nth-child(odd){background-color:#fcfcfc}.rp4wp_button_holder{padding:10px 0;float:right}.rp4wp_button_holder span{margin-left:10px;float:left}.rp4wp_save_button{float:right}.rp4wp_ajaxloader{height:13px;margin-left:10px}
|
assets/css/install.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.install-steps li{width:33%;padding:10px 15px;font-weight:700;color:#eee;background:#222;float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.install-steps li.step-bar-active{background:#0074a2}.install-steps li:first-child{margin-left:0}.rp4wp-step #progress-container{display:none;margin:20px 0 0}.rp4wp-step #progress-container p{font-weight:700}.rp4wp-step #progress-container #progressbar span{line-height:28px;display:block;text-align:right;padding-right:10px;color:#
|
1 |
+
.install-steps li{width:33%;padding:10px 15px;font-weight:700;color:#eee;background:#222;float:left;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.install-steps li.step-bar-active{background:#0074a2}.install-steps li:first-child{margin-left:0}.rp4wp-step #progress-container{display:none;margin:20px 0 0}.rp4wp-step #progress-container p{font-weight:700}.rp4wp-step #progress-container #progressbar span{line-height:28px;display:block;text-align:right;padding-right:10px;color:#3b3b3b}.rp4wp-step .rp4wp-install-link-box label{padding-right:20px}.rp4wp-step .rp4wp-install-link-box input{width:40px;text-align:center}.rp4wp-step .rp4wp-install-link-box a.rp4wp-link-now-btn{margin-left:20px;margin-right:10px}.rp4wp-step .rp4wp-box-upgrade-black{background:#222;color:#ddd;margin:25px 0 0;padding:20px 20px 10px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.rp4wp-step .rp4wp-box-upgrade-black h3{color:#fff;border:0;padding:0;margin:0}.rp4wp-step .rp4wp-box-upgrade-black a{color:#2ea2cc;font-weight:700}.rp4wp-install-link-box{display:inline;padding:15px;border:1px solid #0074a2}.rp4wp-step-2 #progressbar{margin-top:30px}
|
assets/css/scss/edit-post.scss
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
cursor: move;
|
4 |
td {
|
5 |
background-position: 98% 50%;
|
6 |
-
background-image: url('
|
7 |
background-repeat: no-repeat;
|
8 |
}
|
9 |
}
|
@@ -34,4 +34,4 @@
|
|
34 |
.rp4wp_ajaxloader {
|
35 |
height: 13px;
|
36 |
margin-left: 10px;
|
37 |
-
}
|
3 |
cursor: move;
|
4 |
td {
|
5 |
background-position: 98% 50%;
|
6 |
+
background-image: url('../images/grabber.png');
|
7 |
background-repeat: no-repeat;
|
8 |
}
|
9 |
}
|
34 |
.rp4wp_ajaxloader {
|
35 |
height: 13px;
|
36 |
margin-left: 10px;
|
37 |
+
}
|
assets/js/edit-post.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function RP4WP_Related_Manager(
|
1 |
+
function RP4WP_Related_Manager(e){this.container=e,this.init=function(){this.bind(),this.make_sortable()},this.bind=function(){var e=this;jQuery(this.container).find(".rp4wp_table_manage .trash a").bind("click",function(){e.delete_child(this)})},this.fix_helper=function(e,t){return t.children().each(function(){jQuery(this).width(jQuery(this).width())}),t},this.make_sortable=function(){var a=this,r=jQuery(this.container).find(".sortable tbody");r.sortable({helper:a.fix_helper,update:function(e,t){jQuery(a.container).parent().parent().find("h3").eq(0).append(jQuery("<img>").attr("src",jQuery("#rp4wp-dir-img").val()+"ajax-loader.gif").addClass("rp4wp_ajaxloader")),opts={url:ajaxurl,type:"POST",async:!0,cache:!1,dataType:"json",data:{action:"rp4wp_related_sort",rp4wp_items:r.sortable("toArray").toString(),nonce:jQuery(a.container).find("#rp4wp-ajax-nonce").val()},success:function(e){jQuery(".rp4wp_ajaxloader").remove()},error:function(e,t,a){jQuery(".rp4wp_ajaxloader").remove()}},jQuery.ajax(opts)}})},this.delete_child=function(t){var e;confirm(rp4wp_js.confirm_delete_related_post)&&(e={url:ajaxurl,type:"POST",async:!0,cache:!1,dataType:"json",data:{action:"rp4wp_delete_link",id:jQuery(t).closest("tr").attr("id"),nonce:jQuery(this.container).find("#rp4wp-ajax-nonce").val()},success:function(e){jQuery(t).closest("tr").fadeTo("fast",0).slideUp(function(){jQuery(this).remove()})},error:function(e,t,a){}},jQuery.ajax(e))},this.init()}jQuery(function(e){e.each(e(".rp4wp_mb_manage"),function(e,t){new RP4WP_Related_Manager(t)})});
|
assets/js/install.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(
|
1 |
+
jQuery(document).ready(function(e){var t=e(".rp4wp-step").attr("rel");function s(t){this.step=t,this.total_posts=0,this.ppr=null,this.action=null,this.percentage_object=null,this.nonce=null,this.do_request=function(){var r=this;e.post(ajaxurl,{action:this.action,nonce:e("#rp4wp-ajax-nonce").val(),ppr:this.ppr,rel_amount:e("#rp4wp_related_posts_amount").val()},function(t){var s=new RegExp("^[0-9]+$");t=t.trim(),s.test(t)?(s=parseInt(t),r.do_progressbar(s),0<s?r.do_request():r.done()):alert("Woops! Something went wrong while linking.\n\nResponse:\n\n"+t)})},this.done=function(){e("#progressbar").progressbar({value:100}),window.location=e("#rp4wp_admin_url").val()+"?page=rp4wp_install&rp4wp_nonce="+this.nonce+"&step="+(this.step+1)},this.do_progressbar=function(t){var s=this.total_posts-t,t=(s<0&&(s=0),jQuery("#progress-done").html(s),jQuery("#progress-todo").html(t),Math.round(s/this.total_posts*100));0<t&&(this.percentage_object.html(t+"%"),e("#progressbar").progressbar({value:t}))},this.init=function(){switch(e("#progressbar").progressbar({value:!1}),this.percentage_object=jQuery("<span>"),e("#progressbar").find("div:first").append(this.percentage_object),this.do_progressbar(e("#rp4wp_posts_todo").val()),this.total_posts=e("#rp4wp_total_posts").val(),this.nonce=e("#rp4wp_nonce").val(),this.step){case 1:this.ppr=25,this.action="rp4wp_install_save_words";break;case 2:this.ppr=5,this.action="rp4wp_install_link_posts"}jQuery("#progress-container").show(),this.do_request()},this.init()}1==t?s(1):2==t&&e("#rp4wp-link-now").click(function(){s(2)})});
|
assets/js/settings.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(
|
1 |
+
jQuery(function(t){var a=!1;t("#rp4wp-settings-form").submit(function(){return!a&&(a=!0,t(this).find("#submit").attr("disabled","disabled").val("Saving ..."),!0)}),t(".nav-tab-wrapper a").click(function(){return t(".rp4wp-settings-section").hide(),t(".nav-tab-active").removeClass("nav-tab-active"),t(t(this).attr("href")).show(),t(this).addClass("nav-tab-active"),!1}),t(".nav-tab-wrapper a:first").click()});
|
classes/class-multisite-notice.php
CHANGED
@@ -9,7 +9,7 @@ class RP4WP_Multisite_Notice {
|
|
9 |
echo '<div class="error"><p>';
|
10 |
printf( __( "The free version of Related Posts for WordPress doesn't support WordPress Multisite/Network!" ), '<b>', '</b>' );
|
11 |
echo "<br /><br />";
|
12 |
-
printf( __( "%
|
13 |
echo "</p></div>";
|
14 |
}
|
15 |
-
}
|
9 |
echo '<div class="error"><p>';
|
10 |
printf( __( "The free version of Related Posts for WordPress doesn't support WordPress Multisite/Network!" ), '<b>', '</b>' );
|
11 |
echo "<br /><br />";
|
12 |
+
printf( __( "%Upgrade to the premium version%s or disable the plugin." ), '<a href="https://www.relatedpostsforwp.com/upgrade-premium/?utm_source=plugin&utm_medium=link&utm_campaign=multisite-notice" target="_blank">', '</a>' );
|
13 |
echo "</p></div>";
|
14 |
}
|
15 |
+
}
|
classes/class-post-link-manager.php
CHANGED
@@ -360,6 +360,17 @@ class RP4WP_Post_Link_Manager {
|
|
360 |
|
361 |
}
|
362 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
/**
|
364 |
* Generate the children list
|
365 |
*
|
@@ -373,8 +384,7 @@ class RP4WP_Post_Link_Manager {
|
|
373 |
*/
|
374 |
public function generate_children_list( $id, $limit = -1 ) {
|
375 |
|
376 |
-
|
377 |
-
$content = '';
|
378 |
|
379 |
// Get the children
|
380 |
$related_posts = $this->get_children( $id, array( 'posts_per_page' => $limit ) );
|
@@ -383,7 +393,7 @@ class RP4WP_Post_Link_Manager {
|
|
383 |
if ( count( $related_posts ) > 0 ) {
|
384 |
|
385 |
// The rp4wp block
|
386 |
-
|
387 |
|
388 |
// Get the heading text
|
389 |
$heading_text = RP4WP::get()->settings->get_option( 'heading_text' );
|
@@ -396,10 +406,10 @@ class RP4WP_Post_Link_Manager {
|
|
396 |
}
|
397 |
|
398 |
// Filter complete heading
|
399 |
-
|
400 |
|
401 |
// Open the list
|
402 |
-
|
403 |
|
404 |
|
405 |
foreach ( $related_posts as $rp4wp_post ) {
|
@@ -407,8 +417,10 @@ class RP4WP_Post_Link_Manager {
|
|
407 |
// Setup the postdata
|
408 |
setup_postdata( $rp4wp_post );
|
409 |
|
|
|
|
|
410 |
// Output the linked post
|
411 |
-
|
412 |
|
413 |
if ( 1 == RP4WP::get()->settings->get_option( 'display_image' ) ) {
|
414 |
if ( has_post_thumbnail( $rp4wp_post->ID ) ) {
|
@@ -420,41 +432,50 @@ class RP4WP_Post_Link_Manager {
|
|
420 |
*/
|
421 |
$thumb_size = apply_filters( 'rp4wp_thumbnail_size', 'thumbnail' );
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
$
|
427 |
-
|
|
|
|
|
|
|
|
|
428 |
}
|
429 |
}
|
430 |
|
431 |
-
|
432 |
-
|
|
|
|
|
|
|
433 |
|
434 |
$excerpt_length = RP4WP::get()->settings->get_option( 'excerpt_length' );
|
435 |
if ( $excerpt_length > 0 ) {
|
436 |
$excerpt = wp_trim_words( strip_tags( strip_shortcodes( ( ( '' != $rp4wp_post->post_excerpt ) ? $rp4wp_post->post_excerpt : $rp4wp_post->post_content ) ) ), $excerpt_length );
|
437 |
-
|
438 |
}
|
439 |
|
440 |
-
|
|
|
|
|
441 |
|
442 |
-
|
443 |
|
444 |
// Reset the postdata
|
445 |
wp_reset_postdata();
|
446 |
}
|
447 |
|
448 |
// Close the wrapper div
|
449 |
-
|
450 |
|
451 |
-
|
452 |
|
453 |
-
|
454 |
|
455 |
}
|
456 |
|
457 |
-
return
|
458 |
|
459 |
}
|
460 |
|
360 |
|
361 |
}
|
362 |
|
363 |
+
/**
|
364 |
+
* Get link for related post by ID
|
365 |
+
*
|
366 |
+
* @param $post_id
|
367 |
+
*
|
368 |
+
* @return string
|
369 |
+
*/
|
370 |
+
private function get_related_post_link( $post_id ) {
|
371 |
+
return apply_filters( 'rp4wp_post_link', get_permalink( $post_id ), $post_id );
|
372 |
+
}
|
373 |
+
|
374 |
/**
|
375 |
* Generate the children list
|
376 |
*
|
384 |
*/
|
385 |
public function generate_children_list( $id, $limit = -1 ) {
|
386 |
|
387 |
+
ob_start();
|
|
|
388 |
|
389 |
// Get the children
|
390 |
$related_posts = $this->get_children( $id, array( 'posts_per_page' => $limit ) );
|
393 |
if ( count( $related_posts ) > 0 ) {
|
394 |
|
395 |
// The rp4wp block
|
396 |
+
echo "<div class='rp4wp-related-posts'>\n";
|
397 |
|
398 |
// Get the heading text
|
399 |
$heading_text = RP4WP::get()->settings->get_option( 'heading_text' );
|
406 |
}
|
407 |
|
408 |
// Filter complete heading
|
409 |
+
echo apply_filters( 'rp4wp_heading', $heading_text );
|
410 |
|
411 |
// Open the list
|
412 |
+
echo "<ul>\n";
|
413 |
|
414 |
|
415 |
foreach ( $related_posts as $rp4wp_post ) {
|
417 |
// Setup the postdata
|
418 |
setup_postdata( $rp4wp_post );
|
419 |
|
420 |
+
do_action( 'rp4wp_before_content', $rp4wp_post );
|
421 |
+
|
422 |
// Output the linked post
|
423 |
+
echo "<li>";
|
424 |
|
425 |
if ( 1 == RP4WP::get()->settings->get_option( 'display_image' ) ) {
|
426 |
if ( has_post_thumbnail( $rp4wp_post->ID ) ) {
|
432 |
*/
|
433 |
$thumb_size = apply_filters( 'rp4wp_thumbnail_size', 'thumbnail' );
|
434 |
|
435 |
+
do_action( 'rp4wp_before_image', $rp4wp_post );
|
436 |
+
|
437 |
+
echo "<div class='rp4wp-related-post-image'>" . PHP_EOL;
|
438 |
+
echo "<a href='" . $this->get_related_post_link( $rp4wp_post->ID ) . "'>";
|
439 |
+
echo get_the_post_thumbnail( $rp4wp_post->ID, $thumb_size );
|
440 |
+
echo "</a>";
|
441 |
+
echo "</div>" . PHP_EOL;
|
442 |
+
|
443 |
+
do_action( 'rp4wp_after_image', $rp4wp_post );
|
444 |
}
|
445 |
}
|
446 |
|
447 |
+
echo "<div class='rp4wp-related-post-content'>" . PHP_EOL;
|
448 |
+
echo sprintf( apply_filters("rp4wp_post_title_html", "<a href='%s'>%s</a>", $rp4wp_post),
|
449 |
+
$this->get_related_post_link( $rp4wp_post->ID ),
|
450 |
+
apply_filters( 'rp4wp_post_title', $rp4wp_post->post_title, $rp4wp_post )
|
451 |
+
);
|
452 |
|
453 |
$excerpt_length = RP4WP::get()->settings->get_option( 'excerpt_length' );
|
454 |
if ( $excerpt_length > 0 ) {
|
455 |
$excerpt = wp_trim_words( strip_tags( strip_shortcodes( ( ( '' != $rp4wp_post->post_excerpt ) ? $rp4wp_post->post_excerpt : $rp4wp_post->post_content ) ) ), $excerpt_length );
|
456 |
+
echo "<p>" . apply_filters( 'rp4wp_post_excerpt', $excerpt, $rp4wp_post->ID ) . "</p>";
|
457 |
}
|
458 |
|
459 |
+
echo "</div>" . PHP_EOL;
|
460 |
+
|
461 |
+
do_action( 'rp4wp_after_content', $rp4wp_post );
|
462 |
|
463 |
+
echo "</li>\n";
|
464 |
|
465 |
// Reset the postdata
|
466 |
wp_reset_postdata();
|
467 |
}
|
468 |
|
469 |
// Close the wrapper div
|
470 |
+
echo "</ul>\n";
|
471 |
|
472 |
+
echo $this->show_love();
|
473 |
|
474 |
+
echo "</div>\n";
|
475 |
|
476 |
}
|
477 |
|
478 |
+
return trim( ob_get_clean() );
|
479 |
|
480 |
}
|
481 |
|
classes/class-rp4wp.php
CHANGED
@@ -8,7 +8,7 @@ class RP4WP {
|
|
8 |
|
9 |
private static $instance = null;
|
10 |
|
11 |
-
const VERSION = '2.1.
|
12 |
|
13 |
/**
|
14 |
* @var RP4WP_Settings
|
8 |
|
9 |
private static $instance = null;
|
10 |
|
11 |
+
const VERSION = '2.1.1';
|
12 |
|
13 |
/**
|
14 |
* @var RP4WP_Settings
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.barrykooij.com/donate/
|
|
4 |
Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related post, related, relations, internal links, seo, bounce rate
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 6.0.2
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -18,6 +18,8 @@ Related Posts for WordPress offers you the ability to link related posts to each
|
|
18 |
|
19 |
Our installation wizard will do all the hard work for you, simply activate the plugin, set the amount of posts that should relate and press the button. Related Posts for WordPress will do the rest. Relating posts in WordPress has never been this easy!
|
20 |
|
|
|
|
|
21 |
> #### Related Posts for WordPress Premium
|
22 |
> There's an even better version of this plugin that comes with the following extra features:<br />
|
23 |
>
|
@@ -118,6 +120,16 @@ There is one custom table created for the post cache, this table will however no
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 2.1.0: September 12, 2022 =
|
122 |
* Feature: Added compatibility support for Yoast Duplicate Post plugin.
|
123 |
* Tweak: meta data updates.
|
4 |
Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related post, related, relations, internal links, seo, bounce rate
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 6.0.2
|
7 |
+
Stable tag: 2.1.1
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
18 |
|
19 |
Our installation wizard will do all the hard work for you, simply activate the plugin, set the amount of posts that should relate and press the button. Related Posts for WordPress will do the rest. Relating posts in WordPress has never been this easy!
|
20 |
|
21 |
+
Fully tested and working on PHP 5.3 and up (including PHP 8 & 8.1)!
|
22 |
+
|
23 |
> #### Related Posts for WordPress Premium
|
24 |
> There's an even better version of this plugin that comes with the following extra features:<br />
|
25 |
>
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 2.1.1: September 17, 2022 =
|
124 |
+
* Tweak: Added rp4wp_post_title_html filter.
|
125 |
+
* Tweak: Added rp4wp_post_link filter.
|
126 |
+
* Tweak: Added rp4wp_before_content action.
|
127 |
+
* Tweak: Added rp4wp_after_content action.
|
128 |
+
* Tweak: Added rp4wp_before_image action.
|
129 |
+
* Tweak: Added rp4wp_after_image action.
|
130 |
+
* Tweak: Related posts output is now using an output buffer instead of 1 big variable concat.
|
131 |
+
* Tweak: Fixed grabber backend asset path.
|
132 |
+
|
133 |
= 2.1.0: September 12, 2022 =
|
134 |
* Feature: Added compatibility support for Yoast Duplicate Post plugin.
|
135 |
* Tweak: meta data updates.
|
related-posts-for-wp.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Related Posts for WordPress
|
4 |
Plugin URI: http://www.relatedpostsforwp.com/
|
5 |
Description: Related Posts for WordPress, the best way to display related posts in WordPress.
|
6 |
-
Version: 2.1.
|
7 |
Author: Never5
|
8 |
Author URI: http://www.never5.com/
|
9 |
License: GPL v3
|
3 |
Plugin Name: Related Posts for WordPress
|
4 |
Plugin URI: http://www.relatedpostsforwp.com/
|
5 |
Description: Related Posts for WordPress, the best way to display related posts in WordPress.
|
6 |
+
Version: 2.1.1
|
7 |
Author: Never5
|
8 |
Author URI: http://www.never5.com/
|
9 |
License: GPL v3
|