Contextual Related Posts - Version 2.9.2

Version Description

Release post: https://webberzone.com/blog/contextual-related-posts-v2-9-0/

Bug fixes: * Password protected posts will no longer show the excerpt

Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Contextual Related Posts
Version 2.9.2
Comparing to
See all releases

Code changes from version 2.9.1 to 2.9.2

contextual-related-posts.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Contextual Related Posts
16
  * Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
17
  * Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
18
- * Version: 2.9.1
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
15
  * Plugin Name: Contextual Related Posts
16
  * Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
17
  * Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
18
+ * Version: 2.9.2
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
includes/modules/shortcode.php CHANGED
@@ -31,9 +31,10 @@ function crp_shortcode( $atts, $content = null ) { // phpcs:ignore Generic.CodeA
31
  array_merge(
32
  $crp_settings,
33
  array(
34
- 'heading' => 1,
35
- 'is_shortcode' => 1,
36
- 'offset' => 0,
 
37
  )
38
  ),
39
  $atts,
31
  array_merge(
32
  $crp_settings,
33
  array(
34
+ 'heading' => 1,
35
+ 'is_shortcode' => 1,
36
+ 'offset' => 0,
37
+ 'include_cat_ids' => '',
38
  )
39
  ),
40
  $atts,
includes/tools.php CHANGED
@@ -28,13 +28,14 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
28
  $content = '';
29
 
30
  $post = get_post( $id );
31
- if ( $post ) {
32
- if ( $use_excerpt ) {
33
- $content = $post->post_excerpt;
34
- }
35
- if ( empty( $content ) ) {
36
- $content = $post->post_content;
37
- }
 
38
  }
39
 
40
  $output = wp_strip_all_tags( strip_shortcodes( $content ) );
@@ -61,6 +62,10 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
61
  $output = wp_trim_words( $output, $excerpt_length );
62
  }
63
 
 
 
 
 
64
  /**
65
  * Filters excerpt generated by CRP.
66
  *
28
  $content = '';
29
 
30
  $post = get_post( $id );
31
+ if ( empty( $post ) ) {
32
+ return '';
33
+ }
34
+ if ( $use_excerpt ) {
35
+ $content = $post->post_excerpt;
36
+ }
37
+ if ( empty( $content ) ) {
38
+ $content = $post->post_content;
39
  }
40
 
41
  $output = wp_strip_all_tags( strip_shortcodes( $content ) );
62
  $output = wp_trim_words( $output, $excerpt_length );
63
  }
64
 
65
+ if ( post_password_required( $post ) ) {
66
+ $output = __( 'There is no excerpt because this is a protected post.', 'contextual-related-posts' );
67
+ }
68
+
69
  /**
70
  * Filters excerpt generated by CRP.
71
  *
languages/contextual-related-posts-en_US.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2020-04-18 10:45+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
@@ -1262,3 +1262,7 @@ msgstr ""
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2020-05-07 22:01+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
1265
+
1266
+ #: includes/tools.php:66
1267
+ msgid "There is no excerpt because this is a protected post."
1268
+ msgstr ""
languages/contextual-related-posts-en_US.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2020-04-18 10:45+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: plugins@webberzone.com\n"
@@ -1262,3 +1262,7 @@ msgstr ""
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
 
 
 
 
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2020-05-07 22:01+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: plugins@webberzone.com\n"
1262
  #: includes/output-generator.php:239
1263
  msgid " by "
1264
  msgstr ""
1265
+
1266
+ #: includes/tools.php:66
1267
+ msgid "There is no excerpt because this is a protected post."
1268
+ msgstr ""
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: related posts, related, related articles, contextual related posts, similar posts, related posts widget
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
- Stable tag: 2.9.1
6
  Requires at least: 4.9
7
  Tested up to: 5.4
8
  License: GPLv2 or later
@@ -171,12 +171,20 @@ You can insert the related posts anywhere in your post using the `[crp]` shortco
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
 
174
  = 2.9.1 =
175
 
176
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
177
 
178
  Bug fixes:
179
  * Custom CSS box would not save and get cleared out when saving settings
 
180
 
181
  = 2.9.0 =
182
 
@@ -227,5 +235,5 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
227
 
228
  == Upgrade Notice ==
229
 
230
- = 2.9.1 =
231
- New features and bug-fixes. Check the Changelog for more details or view the release post on https://webberzone.com
2
  Tags: related posts, related, related articles, contextual related posts, similar posts, related posts widget
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
+ Stable tag: 2.9.2
6
  Requires at least: 4.9
7
  Tested up to: 5.4
8
  License: GPLv2 or later
171
 
172
  == Changelog ==
173
 
174
+ = 2.9.2 =
175
+
176
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
177
+
178
+ Bug fixes:
179
+ * Password protected posts will no longer show the excerpt
180
+
181
  = 2.9.1 =
182
 
183
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
184
 
185
  Bug fixes:
186
  * Custom CSS box would not save and get cleared out when saving settings
187
+ * `include_cat_ids` didn't work with the shortcode
188
 
189
  = 2.9.0 =
190
 
235
 
236
  == Upgrade Notice ==
237
 
238
+ = 2.9.2 =
239
+ Bug fix release. Check the Changelog for more details or view the release post on https://webberzone.com