Contextual Related Posts - Version 3.0.0

Version Description

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

  • Features:

    • New CRP_Query class for fetching related posts. This replaces get_crp_posts_id() which will be deprecated in a future version
    • CRP Thumbnails now include the loading="lazy" attribute added in WordPress 5.5
    • New parameter more_link_text that can be passed to get_crp() which holds the "read more". Recommended option to customize the more link text using the filter crp_excerpt_more_link_text or the more link element using crp_excerpt_more_link
    • Three new styles: "Masonry" (like Pinterest), "Grid" and "Rounded thumbnails with CSS grid". Might not work with older browsers
    • Imported settings of Related Posts by Categories and Tags. That plugin is now deprecated with this release.
  • Enhancement/Modifications:

    • If WPML or PolyLang are active, get_crp_posts_id() and CRP_Query will return the translated set of post IDs and external processing is no longer needed
    • Use wp_img_tag_add_srcset_and_sizes_attr() to generate srcset and sizes attributes. The original code to display the srcset and sizes attributes will continue to be used
    • Improved caching with inbuilt expiry. Use CRP_CACHE_TIME in your wp-config.php to set how long the cache should be set for. Default is one month
    • CRP_MAX_WORDS has been reduced to 100
    • Dropped the need for FULLTEXT index on post_content which should save some database space
    • Deprecated the following filters: get_crp_posts_id, crp_posts_now_date, crp_posts_from_date, crp_posts_fields, crp_posts_join, crp_posts_where, crp_posts_groupby, crp_posts_having, crp_posts_orderby, crp_posts_limits, get_crp_posts_id_short_circuit
  • Bug fixes:

    • In the settings page, only built-in taxonomies were being incorrectly displayed
    • If "before list item" is empty, then the output was blanked out
    • Settings help has been fixed
    • crp_get_option would return an incorrect value if $crp_settings global variable was not set
Download this release

Release Info

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

Code changes from version 2.9.4 to 3.0.0

Files changed (46) hide show
  1. README.md +2 -6
  2. changelog.txt +57 -0
  3. contextual-related-posts.php +18 -7
  4. css/grid.css +38 -0
  5. css/grid.min.css +1 -0
  6. css/masonry.css +123 -0
  7. css/masonry.min.css +1 -0
  8. css/{default-style.css → rounded-thumbs.css} +0 -0
  9. css/rounded-thumbs.min.css +1 -0
  10. css/thumbs-grid.css +89 -0
  11. css/thumbs-grid.min.css +1 -0
  12. includes/admin/admin.php +8 -8
  13. includes/admin/blocks/related-posts.php +60 -70
  14. includes/admin/default-settings.php +76 -13
  15. includes/admin/help-tab.php +20 -96
  16. includes/admin/images/grid.png +0 -0
  17. includes/admin/images/masonry.png +0 -0
  18. includes/admin/images/{crp-rounded-thumbs.png → rounded-thumbs.png} +0 -0
  19. includes/admin/images/thumbs-grid.png +0 -0
  20. includes/admin/modules/cache.php +0 -188
  21. includes/admin/modules/loader.php +0 -4
  22. includes/admin/modules/metabox.php +0 -4
  23. includes/admin/modules/tools.php +0 -4
  24. includes/admin/register-settings.php +5 -1
  25. includes/admin/save-settings.php +20 -2
  26. includes/admin/settings-page.php +4 -5
  27. includes/class-crp-query.php +686 -0
  28. includes/content.php +0 -4
  29. includes/deprecated.php +0 -36
  30. includes/header.php +70 -24
  31. includes/i10n.php +58 -18
  32. includes/main-query.php +58 -136
  33. includes/media.php +24 -11
  34. includes/modules/cache.php +267 -0
  35. includes/modules/class-crp-widget.php +1 -5
  36. includes/modules/manual-posts.php +0 -4
  37. includes/modules/shortcode.php +5 -8
  38. includes/modules/taxonomies.php +0 -4
  39. includes/output-generator.php +1 -5
  40. includes/plugin-activator.php +0 -4
  41. includes/tools.php +68 -25
  42. languages/contextual-related-posts-en_US.po +259 -236
  43. languages/contextual-related-posts-en_US.pot +259 -236
  44. phpcs.ruleset.xml +17 -0
  45. readme.txt +23 -59
  46. uninstall.php +2 -3
README.md CHANGED
@@ -6,9 +6,9 @@
6
  [![Build Status](https://travis-ci.org/WebberZone/contextual-related-posts.svg?branch=master)](https://travis-ci.org/WebberZone/contextual-related-posts)
7
  [![Code Climate](https://codeclimate.com/github/WebberZone/contextual-related-posts/badges/gpa.svg)](https://codeclimate.com/github/WebberZone/contextual-related-posts)
8
 
9
- __Requires:__ 4.9
10
 
11
- __Tested up to:__ 5.5
12
 
13
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
14
 
@@ -54,10 +54,6 @@ On activation, the plugin creates three mySQL FULLTEXT indices (or indexes) that
54
 
55
  You have two sets of options in the settings page which allows you to remove these indices when you deactivate or delete the plugin. The latter is true by default.
56
 
57
- ### Extensions/Addons
58
-
59
- * [Related Posts by Categories and Tags](https://webberzone.com/downloads/crp-taxonomy/)
60
-
61
  ### GDPR
62
 
63
  Contextual Related Posts is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. All posts are processed on your site and not sent to any external service.
6
  [![Build Status](https://travis-ci.org/WebberZone/contextual-related-posts.svg?branch=master)](https://travis-ci.org/WebberZone/contextual-related-posts)
7
  [![Code Climate](https://codeclimate.com/github/WebberZone/contextual-related-posts/badges/gpa.svg)](https://codeclimate.com/github/WebberZone/contextual-related-posts)
8
 
9
+ __Requires:__ 5.0
10
 
11
+ __Tested up to:__ 5.6
12
 
13
  __License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
14
 
54
 
55
  You have two sets of options in the settings page which allows you to remove these indices when you deactivate or delete the plugin. The latter is true by default.
56
 
 
 
 
 
57
  ### GDPR
58
 
59
  Contextual Related Posts is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. All posts are processed on your site and not sent to any external service.
changelog.txt CHANGED
@@ -2,6 +2,63 @@
2
 
3
  This is an archive of older changelog entries. Most recent entries are maintained in readme.txt
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  = 2.8.0 =
6
 
7
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-8-0/](https://webberzone.com/blog/contextual-related-posts-v2-8-0/)
2
 
3
  This is an archive of older changelog entries. Most recent entries are maintained in readme.txt
4
 
5
+ = 2.9.4 =
6
+
7
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-3/](https://webberzone.com/blog/contextual-related-posts-v2-9-3/)
8
+
9
+ * Bugs:
10
+ * Fixed nonce verification not always done in Import/Export interface. Thanks to [Lenon Leite](https://github.com/lenonleite)
11
+
12
+ = 2.9.3 =
13
+
14
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-3/](https://webberzone.com/blog/contextual-related-posts-v2-9-3/)
15
+
16
+ * Features:
17
+ * New constant `CRP_VERSION` to hold the current version of the plugin
18
+ * New setting to delete FULLTEXT indices on deactivation
19
+
20
+ * Enhancements:
21
+ * Added the `$args` attribute to the filters in main-query.php
22
+
23
+ = 2.9.2 =
24
+
25
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
26
+
27
+ Bug fixes:
28
+ * Password protected posts will no longer show the excerpt
29
+
30
+ = 2.9.1 =
31
+
32
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
33
+
34
+ Bug fixes:
35
+ * Custom CSS box would not save and get cleared out when saving settings
36
+ * `include_cat_ids` didn't work with the shortcode
37
+
38
+ = 2.9.0 =
39
+
40
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
41
+
42
+ * Features:
43
+ * New section under Settings > Related Posts > Tools to export and import settings. Best option if you'd like the same configuration across multiple WordPress sites
44
+ * New shortcode setting `include_cat_ids` to limit top posts to selected categories/taxonomies. Use a comma separated list of [term_taxonomy_id](https://codex.wordpress.org/WordPress_Taxonomy#wp_term_taxonomy)
45
+ * New setting in widget to only include certain categories. Doesn't work with custom taxonomies
46
+
47
+ * Enhancements:
48
+ * New function: `crp_get_thumb_size()` to get the correct size of the thumbnail
49
+ * Only run a get_post query if only the post ID is passed to `crp_get_the_post_thumbnail()`
50
+ * `$match_fields` parameter added to `crp_posts_match` filter
51
+ * Updated WPML functions to use latest filters
52
+ * Admin scripts are no longer loaded into the head - but using a separate JavaScript file
53
+ * Implemented CodeMirror to format custom styles box
54
+ * New filters `get_crp_short_circuit` and `get_crp_posts_id_short_circuit` to bypass outputs and queries
55
+ * `CRP_MAX_WORDS` has been reduced from 500 to 250 to avoid "Too many words" mySQL error
56
+ * The link to the Contextual Related Posts link is no longer a list item but a smaller text paragraph below the items. You can turn this on by enabling Show Credit.
57
+
58
+ * Bug fixes:
59
+ * Fixed errors created when trying to fetch a featured image or scanned images with remote links
60
+ * Saving categories fields in the settings page uses `str_getcsv` and a custom function `crp_str_putcsv`
61
+
62
  = 2.8.0 =
63
 
64
  Release post: [https://webberzone.com/blog/contextual-related-posts-v2-8-0/](https://webberzone.com/blog/contextual-related-posts-v2-8-0/)
contextual-related-posts.php CHANGED
@@ -9,13 +9,13 @@
9
  * @author Ajay D'Souza
10
  * @license GPL-2.0+
11
  * @link https://webberzone.com
12
- * @copyright 2009-2020 Ajay D'Souza
13
  *
14
  * @wordpress-plugin
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.4
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
@@ -38,7 +38,7 @@ if ( ! defined( 'WPINC' ) ) {
38
  * @var string Contextual Related Posts Version.
39
  */
40
  if ( ! defined( 'CRP_VERSION' ) ) {
41
- define( 'CRP_VERSION', '2.9.3' );
42
  }
43
 
44
 
@@ -84,7 +84,18 @@ if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
84
  * @var int Maximum number of words to match.
85
  */
86
  if ( ! defined( 'CRP_MAX_WORDS' ) ) {
87
- define( 'CRP_MAX_WORDS', 250 );
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
 
90
  /*
@@ -97,13 +108,15 @@ require_once CRP_PLUGIN_DIR . 'includes/admin/default-settings.php';
97
  require_once CRP_PLUGIN_DIR . 'includes/admin/register-settings.php';
98
  require_once CRP_PLUGIN_DIR . 'includes/plugin-activator.php';
99
  require_once CRP_PLUGIN_DIR . 'includes/i10n.php';
 
 
100
  require_once CRP_PLUGIN_DIR . 'includes/output-generator.php';
101
  require_once CRP_PLUGIN_DIR . 'includes/media.php';
102
  require_once CRP_PLUGIN_DIR . 'includes/tools.php';
103
  require_once CRP_PLUGIN_DIR . 'includes/header.php';
104
  require_once CRP_PLUGIN_DIR . 'includes/content.php';
105
- require_once CRP_PLUGIN_DIR . 'includes/main-query.php';
106
  require_once CRP_PLUGIN_DIR . 'includes/modules/manual-posts.php';
 
107
  require_once CRP_PLUGIN_DIR . 'includes/modules/shortcode.php';
108
  require_once CRP_PLUGIN_DIR . 'includes/modules/taxonomies.php';
109
  require_once CRP_PLUGIN_DIR . 'includes/modules/exclusions.php';
@@ -126,8 +139,6 @@ if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
126
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/tools.php';
127
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/loader.php';
128
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/metabox.php';
129
- require_once CRP_PLUGIN_DIR . 'includes/admin/modules/cache.php';
130
-
131
  } // End if.
132
 
133
 
9
  * @author Ajay D'Souza
10
  * @license GPL-2.0+
11
  * @link https://webberzone.com
12
+ * @copyright 2009-2021 Ajay D'Souza
13
  *
14
  * @wordpress-plugin
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: 3.0.0
19
  * Author: WebberZone
20
  * Author URI: https://webberzone.com
21
  * License: GPL-2.0+
38
  * @var string Contextual Related Posts Version.
39
  */
40
  if ( ! defined( 'CRP_VERSION' ) ) {
41
+ define( 'CRP_VERSION', '3.0.0' );
42
  }
43
 
44
 
84
  * @var int Maximum number of words to match.
85
  */
86
  if ( ! defined( 'CRP_MAX_WORDS' ) ) {
87
+ define( 'CRP_MAX_WORDS', 100 );
88
+ }
89
+
90
+ /**
91
+ * CRP Cache expiration time.
92
+ *
93
+ * @since 3.0.0
94
+ *
95
+ * @var int Cache time. Default is one month.
96
+ */
97
+ if ( ! defined( 'CRP_CACHE_TIME' ) ) {
98
+ define( 'CRP_CACHE_TIME', MONTH_IN_SECONDS );
99
  }
100
 
101
  /*
108
  require_once CRP_PLUGIN_DIR . 'includes/admin/register-settings.php';
109
  require_once CRP_PLUGIN_DIR . 'includes/plugin-activator.php';
110
  require_once CRP_PLUGIN_DIR . 'includes/i10n.php';
111
+ require_once CRP_PLUGIN_DIR . 'includes/class-crp-query.php';
112
+ require_once CRP_PLUGIN_DIR . 'includes/main-query.php';
113
  require_once CRP_PLUGIN_DIR . 'includes/output-generator.php';
114
  require_once CRP_PLUGIN_DIR . 'includes/media.php';
115
  require_once CRP_PLUGIN_DIR . 'includes/tools.php';
116
  require_once CRP_PLUGIN_DIR . 'includes/header.php';
117
  require_once CRP_PLUGIN_DIR . 'includes/content.php';
 
118
  require_once CRP_PLUGIN_DIR . 'includes/modules/manual-posts.php';
119
+ require_once CRP_PLUGIN_DIR . 'includes/modules/cache.php';
120
  require_once CRP_PLUGIN_DIR . 'includes/modules/shortcode.php';
121
  require_once CRP_PLUGIN_DIR . 'includes/modules/taxonomies.php';
122
  require_once CRP_PLUGIN_DIR . 'includes/modules/exclusions.php';
139
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/tools.php';
140
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/loader.php';
141
  require_once CRP_PLUGIN_DIR . 'includes/admin/modules/metabox.php';
 
 
142
  } // End if.
143
 
144
 
css/grid.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .crp_related {
2
+ clear: both;
3
+ margin: 10px 0;
4
+ }
5
+ .crp_related h3 {
6
+ margin: 0 !important;
7
+ }
8
+ .crp_related ul {
9
+ display: grid;
10
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
11
+ gap: 10px;
12
+ margin: 0;
13
+ justify-items: center;
14
+ list-style: none;
15
+ }
16
+ .crp_related ul li {
17
+ text-align:left;
18
+ }
19
+ .crp_related .crp_thumb, .crp_related .crp_title {
20
+ display: block;
21
+ margin: 0 auto;
22
+ }
23
+ .crp_related ul li a {
24
+ text-decoration: none !important;
25
+ }
26
+ .crp_related ul li img {
27
+ max-width: 100%;
28
+ height: auto;
29
+ display: block;
30
+ margin: 0 auto;
31
+ }
32
+ .crp_clear {
33
+ clear: both;
34
+ }
35
+ .crp_author, .crp_date, .crp_excerpt {
36
+ display: block;
37
+ font-size: 0.9em;
38
+ }
css/grid.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .crp_related{clear:both;margin:10px 0}.crp_related h3{margin:0!important}.crp_related ul{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin:0;justify-items:center;list-style:none}.crp_related ul li{text-align:left}.crp_related .crp_thumb,.crp_related .crp_title{display:block;margin:0 auto}.crp_related ul li a{text-decoration:none!important}.crp_related ul li img{max-width:100%;height:auto;display:block;margin:0 auto}.crp_clear{clear:both}.crp_author,.crp_date,.crp_excerpt{display:block;font-size:.9em}
css/masonry.css ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @keyframes wzslideup {
2
+ from {transform: translateY(80px);}
3
+ to {transform: translateY(0);}
4
+ }
5
+ @-webkit-keyframes wzslideup {
6
+ from {-webkit-transform: translateY(80px);}
7
+ to {-webkit-transform: translateY(0);}
8
+ }
9
+ @-moz-keyframes wzslideup {
10
+ from {-moz-transform: translateY(80px);}
11
+ to {-moz-transform: translateY(0);}
12
+ }
13
+ @-webkit-keyframes wzfadein {
14
+ from {opacity: 0;}
15
+ to {opacity: 1;}
16
+ }
17
+ @-moz-keyframes wzfadein {
18
+ from {opacity: 0;}
19
+ to {opacity: 1;}
20
+ }
21
+ @keyframes wzfadein {
22
+ from {opacity: 0;}
23
+ to {opacity: 1;}
24
+ }
25
+
26
+ .crp_related {
27
+ width: 100%;
28
+ margin: 10px auto;
29
+ clear: both;
30
+ }
31
+ .crp_related h3 {
32
+ margin: 0 !important;
33
+ }
34
+ .crp_related ul {
35
+ margin: 1em 0;
36
+ padding: 0;
37
+ -moz-column-gap: 1em;
38
+ -webkit-column-gap: 1em;
39
+ column-gap: 1em;
40
+ font-size: .85em;
41
+ list-style-type: none;
42
+ }
43
+ .crp_related ul li {
44
+ background: #fff;
45
+ padding: 3px;
46
+ margin: 0 0 1em;
47
+ width: 100%;
48
+ box-sizing: border-box;
49
+ -moz-box-sizing: border-box;
50
+ -webkit-box-sizing: border-box;
51
+ box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.18);
52
+
53
+ border-radius: 3px;
54
+ -moz-border-radius: 3px;
55
+ -webkit-border-radius: 3px;
56
+ border: 1px solid #efefef;
57
+
58
+ animation: wzslideup 0.8s ease-out, wzfadein 1s ease-out;
59
+ -webkit-animation: wzslideup 0.8s ease-out, wzfadein 1s ease-out;
60
+ -moz-animation: wzslideup 0.8s ease-out, wzfadein 1s ease;
61
+
62
+ font-size: 1em;
63
+ text-align: center;
64
+ display:inline-block;
65
+ }
66
+ .crp_related ul li a {
67
+ display: block;
68
+ text-decoration: none !important;
69
+ border: 0;
70
+ box-shadow: none;
71
+ }
72
+ .crp_related ul li .crp_author a {
73
+ display: inline;
74
+ }
75
+ .crp_author, .crp_date, .crp_excerpt {
76
+ display: block;
77
+ font-size: 0.9em;
78
+ }
79
+ .crp_title {
80
+ display: block;
81
+ margin: .25em 0;
82
+ color: #666;
83
+ }
84
+ .crp_related ul li a:hover {
85
+ color: #666;
86
+ border-color: #888;
87
+ text-decoration: none !important;
88
+ }
89
+ .crp_related ul li:hover {
90
+ box-shadow: 0px 5px 20px 3px rgba(0,0,0,0.1) !important;
91
+
92
+ -webkit-transition: all .2s;
93
+ -webkit-transform: scale(1.03, 1.03);;
94
+ -moz-transition: all .2s;
95
+ -moz-transform: scale(1.03, 1.03);;
96
+ transition: all .2s;
97
+ transform: scale(1.03);;
98
+ }
99
+
100
+ @media only screen and (min-width: 700px) {
101
+ .crp_related ul {
102
+ -moz-column-count: 2;
103
+ -webkit-column-count: 2;
104
+ column-count: 2;
105
+ }
106
+ }
107
+ @media only screen and (min-width: 900px) {
108
+ .crp_related ul {
109
+ -moz-column-count: 3;
110
+ -webkit-column-count: 3;
111
+ column-count: 3;
112
+ }
113
+ }
114
+ .crp_related ul li img {
115
+ max-width: 100%;
116
+ height: auto;
117
+ display: block;
118
+ margin: 0 auto;
119
+ }
120
+ .crp_clear {
121
+ clear: both;
122
+ }
123
+
css/masonry.min.css ADDED
@@ -0,0 +1 @@
 
1
+ @keyframes wzslideup{from{transform:translateY(80px)}to{transform:translateY(0)}}@-webkit-keyframes wzslideup{from{-webkit-transform:translateY(80px)}to{-webkit-transform:translateY(0)}}@-moz-keyframes wzslideup{from{-moz-transform:translateY(80px)}to{-moz-transform:translateY(0)}}@-webkit-keyframes wzfadein{from{opacity:0}to{opacity:1}}@-moz-keyframes wzfadein{from{opacity:0}to{opacity:1}}@keyframes wzfadein{from{opacity:0}to{opacity:1}}.crp_related{width:100%;margin:10px auto;clear:both}.crp_related h3{margin:0!important}.crp_related ul{margin:1em 0;padding:0;-moz-column-gap:1em;-webkit-column-gap:1em;column-gap:1em;font-size:.85em;list-style-type:none}.crp_related ul li{background:#fff;padding:3px;margin:0 0 1em;width:100%;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-shadow:0 1px 1px 0 rgba(0,0,0,.18);border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;border:1px solid #efefef;animation:wzslideup .8s ease-out,wzfadein 1s ease-out;-webkit-animation:wzslideup .8s ease-out,wzfadein 1s ease-out;-moz-animation:wzslideup .8s ease-out,wzfadein 1s ease;font-size:1em;text-align:center;display:inline-block}.crp_related ul li a{display:block;text-decoration:none!important;border:0;box-shadow:none}.crp_related ul li .crp_author a{display:inline}.crp_author,.crp_date,.crp_excerpt{display:block;font-size:.9em}.crp_title{display:block;margin:.25em 0;color:#666}.crp_related ul li a:hover{color:#666;border-color:#888;text-decoration:none!important}.crp_related ul li:hover{box-shadow:0 5px 20px 3px rgba(0,0,0,.1)!important;-webkit-transition:all .2s;-webkit-transform:scale(1.03,1.03);-moz-transition:all .2s;-moz-transform:scale(1.03,1.03);transition:all .2s;transform:scale(1.03)}@media only screen and (min-width:700px){.crp_related ul{-moz-column-count:2;-webkit-column-count:2;column-count:2}}@media only screen and (min-width:900px){.crp_related ul{-moz-column-count:3;-webkit-column-count:3;column-count:3}}.crp_related ul li img{max-width:100%;height:auto;display:block;margin:0 auto}.crp_clear{clear:both}
css/{default-style.css → rounded-thumbs.css} RENAMED
File without changes
css/rounded-thumbs.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .crp_related{clear:both;margin:10px 0}.crp_related h3{margin:0!important}.crp_related ul{list-style:none;float:left;margin:0!important;padding:0!important}.crp_related a,.crp_related li{float:left;overflow:hidden;position:relative;text-align:center}.crp_related li{margin:5px!important;border:1px solid #ddd;padding:6px}.crp_related li:hover{background:#eee;border-color:#bbb}.crp_related a{-webkit-box-shadow:none!important;-moz-box-shadow:none!important;box-shadow:none!important;text-decoration:none!important}.crp_related a:hover{text-decoration:none}.crp_related .crp_title{color:#fff!important;position:absolute;display:block;bottom:0;padding:3px;font-size:.9em;text-shadow:.1em .1em .2em #000;background-color:rgba(0,0,0,.5);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.crp_related li:hover .crp_title{background-color:rgba(0,0,0,.8)}.crp_related li{vertical-align:bottom;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.4);-moz-box-shadow:0 1px 2px rgba(0,0,0,.4);box-shadow:0 1px 2px rgba(0,0,0,.4);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px;list-style-type:none}.crp_clear{clear:both}.crp_title:visited{color:#fff!important}
css/thumbs-grid.css ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .crp_related {
2
+ clear: both;
3
+ margin: 10px 0;
4
+ }
5
+ .crp_related ul {
6
+ display: grid;
7
+ grid-gap: 10px;
8
+ margin: 0;
9
+ justify-items: center;
10
+ list-style: none;
11
+ }
12
+ .crp_related ul li {
13
+ text-align:center;
14
+ border: 1px solid #ddd;
15
+ display: flex;
16
+ flex-direction: column;
17
+ }
18
+ .crp_related li:hover {
19
+ background: #eee;
20
+ border-color: #bbb;
21
+ }
22
+ .crp_related ul li a.crp_link {
23
+ flex-grow: 1;
24
+ display: grid;
25
+ overflow: hidden;
26
+ padding: 3px;
27
+ }
28
+ .crp_related ul li a.crp_link .crp_thumb {
29
+ grid-row-start: 1;
30
+ grid-row-end: 3;
31
+ grid-column-start: 1;
32
+ grid-column-end: 2;
33
+ }
34
+ .crp_related ul li a.crp_link .crp_title {
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ grid-row-start: 2;
39
+ grid-row-end: 3;
40
+ grid-column-start: 1;
41
+ grid-column-end: 2;
42
+ }
43
+ .crp_related a {
44
+ -webkit-box-shadow: none !important;
45
+ -moz-box-shadow: none !important;
46
+ box-shadow: none !important;
47
+ text-decoration: none !important;
48
+ }
49
+ .crp_related a:hover {
50
+ text-decoration: none;
51
+ }
52
+ .crp_related ul li img {
53
+ max-width: 100%;
54
+ height: auto;
55
+ display: block;
56
+ margin: 0 auto;
57
+ }
58
+ .crp_related .crp_title {
59
+ color: #fff !important;
60
+ padding: 3px;
61
+ font-size: .9em;
62
+ text-shadow: .1em .1em .2em #000;
63
+ background-color: rgba(0, 0, 0, 0.5);
64
+ -webkit-border-radius: 7px;
65
+ -moz-border-radius: 7px;
66
+ border-radius: 7px;
67
+ width: 100%;
68
+ overflow: hidden;
69
+ line-height: initial;
70
+ }
71
+ .crp_related li:hover .crp_title {
72
+ background-color: rgba(0, 0, 0, 0.8);
73
+ }
74
+ .crp_related li {
75
+ vertical-align: bottom;
76
+ -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.4);
77
+ -moz-box-shadow: 0 1px 2px rgba(0,0,0,.4);
78
+ box-shadow: 0 1px 2px rgba(0,0,0,.4);
79
+ -webkit-border-radius: 7px;
80
+ -moz-border-radius: 7px;
81
+ border-radius: 7px;
82
+ list-style-type: none;
83
+ }
84
+ .crp_clear {
85
+ clear: both;
86
+ }
87
+ .crp_title:visited {
88
+ color: #fff !important;
89
+ }
css/thumbs-grid.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .crp_related{clear:both;margin:10px 0}.crp_related ul{display:grid;grid-gap:10px;margin:0;justify-items:center;list-style:none}.crp_related ul li{text-align:center;border:1px solid #ddd;display:flex;flex-direction:column}.crp_related li:hover{background:#eee;border-color:#bbb}.crp_related ul li a.crp_link{flex-grow:1;display:grid;overflow:hidden;padding:3px}.crp_related ul li a.crp_link .crp_thumb{grid-row-start:1;grid-row-end:3;grid-column-start:1;grid-column-end:2}.crp_related ul li a.crp_link .crp_title{display:flex;justify-content:center;align-items:center;grid-row-start:2;grid-row-end:3;grid-column-start:1;grid-column-end:2}.crp_related a{-webkit-box-shadow:none!important;-moz-box-shadow:none!important;box-shadow:none!important;text-decoration:none!important}.crp_related a:hover{text-decoration:none}.crp_related ul li img{max-width:100%;height:auto;display:block;margin:0 auto}.crp_related .crp_title{color:#fff!important;padding:3px;font-size:.9em;text-shadow:.1em .1em .2em #000;background-color:rgba(0,0,0,.5);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px;width:100%;overflow:hidden;line-height:initial}.crp_related li:hover .crp_title{background-color:rgba(0,0,0,.8)}.crp_related li{vertical-align:bottom;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.4);-moz-box-shadow:0 1px 2px rgba(0,0,0,.4);box-shadow:0 1px 2px rgba(0,0,0,.4);-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px;list-style-type:none}.crp_clear{clear:both}.crp_title:visited{color:#fff!important}
includes/admin/admin.php CHANGED
@@ -21,11 +21,11 @@ if ( ! defined( 'WPINC' ) ) {
21
  *
22
  * @since 2.6.0
23
  *
24
- * @global $crp_settings_page, $crp_settings_tools_help
25
  * @return void
26
  */
27
  function crp_add_admin_pages_links() {
28
- global $crp_settings_page, $crp_settings_tools_help;
29
 
30
  $crp_settings_page = add_options_page(
31
  esc_html__( 'Contextual Related Posts', 'contextual-related-posts' ),
@@ -36,7 +36,7 @@ function crp_add_admin_pages_links() {
36
  );
37
  add_action( "load-$crp_settings_page", 'crp_settings_help' ); // Load the settings contextual help.
38
 
39
- $crp_settings_tools_help = add_submenu_page(
40
  $crp_settings_page,
41
  esc_html__( 'Contextual Related Posts Tools', 'contextual-related-posts' ),
42
  esc_html__( 'Tools', 'contextual-related-posts' ),
@@ -44,7 +44,7 @@ function crp_add_admin_pages_links() {
44
  'crp_tools_page',
45
  'crp_tools_page'
46
  );
47
- add_action( "load-$crp_settings_tools_help", 'crp_settings_tools_help' );
48
 
49
  }
50
  add_action( 'admin_menu', 'crp_add_admin_pages_links' );
@@ -59,11 +59,11 @@ add_action( 'admin_menu', 'crp_add_admin_pages_links' );
59
  * @return string Updated Footer text
60
  */
61
  function crp_admin_footer( $footer_text ) {
62
- global $crp_settings_page, $crp_settings_tools_help;
63
 
64
  $current_screen = get_current_screen();
65
 
66
- if ( $current_screen->id === $crp_settings_page || $current_screen->id === $crp_settings_tools_help ) {
67
 
68
  $text = sprintf(
69
  /* translators: 1: Contextual Related Posts website, 2: Plugin reviews link. */
@@ -92,7 +92,7 @@ add_filter( 'admin_footer_text', 'crp_admin_footer' );
92
  */
93
  function crp_load_admin_scripts( $hook ) {
94
 
95
- global $crp_settings_page, $crp_settings_tools_help;
96
 
97
  wp_register_script( 'crp-admin-js', CRP_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ), '1.0', true );
98
  wp_register_script( 'crp-suggest-js', CRP_PLUGIN_URL . 'includes/admin/js/crp-suggest.min.js', array( 'jquery', 'jquery-ui-autocomplete' ), '1.0', true );
@@ -105,7 +105,7 @@ function crp_load_admin_scripts( $hook ) {
105
  false
106
  );
107
 
108
- if ( in_array( $hook, array( $crp_settings_page, $crp_settings_tools_help ), true ) ) {
109
 
110
  wp_enqueue_script( 'crp-admin-js' );
111
  wp_enqueue_script( 'crp-suggest-js' );
21
  *
22
  * @since 2.6.0
23
  *
24
+ * @global $crp_settings_page, $crp_settings_tools
25
  * @return void
26
  */
27
  function crp_add_admin_pages_links() {
28
+ global $crp_settings_page, $crp_settings_tools;
29
 
30
  $crp_settings_page = add_options_page(
31
  esc_html__( 'Contextual Related Posts', 'contextual-related-posts' ),
36
  );
37
  add_action( "load-$crp_settings_page", 'crp_settings_help' ); // Load the settings contextual help.
38
 
39
+ $crp_settings_tools = add_submenu_page(
40
  $crp_settings_page,
41
  esc_html__( 'Contextual Related Posts Tools', 'contextual-related-posts' ),
42
  esc_html__( 'Tools', 'contextual-related-posts' ),
44
  'crp_tools_page',
45
  'crp_tools_page'
46
  );
47
+ add_action( "load-$crp_settings_tools", 'crp_settings_help' );
48
 
49
  }
50
  add_action( 'admin_menu', 'crp_add_admin_pages_links' );
59
  * @return string Updated Footer text
60
  */
61
  function crp_admin_footer( $footer_text ) {
62
+ global $crp_settings_page, $crp_settings_tools;
63
 
64
  $current_screen = get_current_screen();
65
 
66
+ if ( $current_screen->id === $crp_settings_page || $current_screen->id === $crp_settings_tools ) {
67
 
68
  $text = sprintf(
69
  /* translators: 1: Contextual Related Posts website, 2: Plugin reviews link. */
92
  */
93
  function crp_load_admin_scripts( $hook ) {
94
 
95
+ global $crp_settings_page, $crp_settings_tools;
96
 
97
  wp_register_script( 'crp-admin-js', CRP_PLUGIN_URL . 'includes/admin/js/admin-scripts.min.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-datepicker' ), '1.0', true );
98
  wp_register_script( 'crp-suggest-js', CRP_PLUGIN_URL . 'includes/admin/js/crp-suggest.min.js', array( 'jquery', 'jquery-ui-autocomplete' ), '1.0', true );
105
  false
106
  );
107
 
108
+ if ( in_array( $hook, array( $crp_settings_page, $crp_settings_tools ), true ) ) {
109
 
110
  wp_enqueue_script( 'crp-admin-js' );
111
  wp_enqueue_script( 'crp-suggest-js' );
includes/admin/blocks/related-posts.php CHANGED
@@ -74,88 +74,78 @@ function crp_block_init() {
74
  );
75
  wp_localize_script( 'related-posts-block-editor', 'crp_php_variables', $localized_variables );
76
 
77
- if ( 'rounded_thumbs' === crp_get_option( 'crp_styles' ) ) {
78
 
79
- $thumb_width = crp_get_option( 'thumb_width' );
80
- $thumb_height = crp_get_option( 'thumb_height' );
 
81
 
82
  wp_register_style(
83
  'related-posts-block-editor',
84
- plugins_url( 'css/default-style.css', CRP_PLUGIN_FILE ),
85
  array( 'wp-edit-blocks' ),
86
  '1.0'
87
  );
88
- $custom_css = "
89
- .crp_related a {
90
- width: {$thumb_width}px;
91
- height: {$thumb_height}px;
92
- text-decoration: none;
93
- }
94
- .crp_related img {
95
- max-width: {$thumb_width}px;
96
- margin: auto;
97
- }
98
- .crp_related .crp_title {
99
- width: 100%;
100
- }
101
- ";
102
 
103
- wp_add_inline_style( 'related-posts-block-editor', $custom_css );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  register_block_type(
107
  'contextual-related-posts/related-posts',
108
- array(
109
- 'editor_script' => 'related-posts-block-editor',
110
- 'editor_style' => 'related-posts-block-editor',
111
- 'render_callback' => 'render_crp_block',
112
- 'attributes' => array(
113
- 'className' => array(
114
- 'type' => 'string',
115
- 'default' => '',
116
- ),
117
- 'heading' => array(
118
- 'type' => 'boolean',
119
- 'default' => false,
120
- ),
121
- 'limit' => array(
122
- 'type' => 'number',
123
- 'default' => 6,
124
- ),
125
- 'offset' => array(
126
- 'type' => 'number',
127
- 'default' => 0,
128
- ),
129
- 'show_excerpt' => array(
130
- 'type' => 'boolean',
131
- 'default' => false,
132
- ),
133
- 'show_author' => array(
134
- 'type' => 'boolean',
135
- 'default' => false,
136
- ),
137
- 'show_date' => array(
138
- 'type' => 'boolean',
139
- 'default' => false,
140
- ),
141
- 'post_thumb_op' => array(
142
- 'type' => 'string',
143
- 'default' => 'inline',
144
- ),
145
- 'ordering' => array(
146
- 'type' => 'string',
147
- 'default' => 'relevance',
148
- ),
149
- 'random_order' => array(
150
- 'type' => 'boolean',
151
- 'default' => false,
152
- ),
153
- 'other_attributes' => array(
154
- 'type' => 'string',
155
- 'default' => '',
156
- ),
157
- ),
158
- )
159
  );
160
 
161
  if ( function_exists( 'wp_set_script_translations' ) ) {
74
  );
75
  wp_localize_script( 'related-posts-block-editor', 'crp_php_variables', $localized_variables );
76
 
77
+ $style_array = crp_get_style();
78
 
79
+ if ( ! empty( $style_array ) ) {
80
+ $style = $style_array['name'];
81
+ $extra_css = $style_array['extra_css'];
82
 
83
  wp_register_style(
84
  'related-posts-block-editor',
85
+ plugins_url( "css/{$style}.min.css", CRP_PLUGIN_FILE ),
86
  array( 'wp-edit-blocks' ),
87
  '1.0'
88
  );
89
+ wp_add_inline_style( 'related-posts-block-editor', $extra_css );
90
+ }
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
+ $args = array(
93
+ 'editor_script' => 'related-posts-block-editor',
94
+ 'render_callback' => 'render_crp_block',
95
+ 'attributes' => array(
96
+ 'className' => array(
97
+ 'type' => 'string',
98
+ 'default' => '',
99
+ ),
100
+ 'heading' => array(
101
+ 'type' => 'boolean',
102
+ 'default' => false,
103
+ ),
104
+ 'limit' => array(
105
+ 'type' => 'number',
106
+ 'default' => 6,
107
+ ),
108
+ 'offset' => array(
109
+ 'type' => 'number',
110
+ 'default' => 0,
111
+ ),
112
+ 'show_excerpt' => array(
113
+ 'type' => 'boolean',
114
+ 'default' => false,
115
+ ),
116
+ 'show_author' => array(
117
+ 'type' => 'boolean',
118
+ 'default' => false,
119
+ ),
120
+ 'show_date' => array(
121
+ 'type' => 'boolean',
122
+ 'default' => false,
123
+ ),
124
+ 'post_thumb_op' => array(
125
+ 'type' => 'string',
126
+ 'default' => 'inline',
127
+ ),
128
+ 'ordering' => array(
129
+ 'type' => 'string',
130
+ 'default' => 'relevance',
131
+ ),
132
+ 'random_order' => array(
133
+ 'type' => 'boolean',
134
+ 'default' => false,
135
+ ),
136
+ 'other_attributes' => array(
137
+ 'type' => 'string',
138
+ 'default' => '',
139
+ ),
140
+ ),
141
+ );
142
+ if ( ! empty( $style ) ) {
143
+ $args['editor_style'] = 'related-posts-block-editor';
144
  }
145
 
146
  register_block_type(
147
  'contextual-related-posts/related-posts',
148
+ $args
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  );
150
 
151
  if ( function_exists( 'wp_set_script_translations' ) ) {
includes/admin/default-settings.php CHANGED
@@ -106,6 +106,28 @@ function crp_settings_general() {
106
  'options' => '-1',
107
  'min' => '-1',
108
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  'disable_on_mobile' => array(
110
  'id' => 'disable_on_mobile',
111
  'name' => esc_html__( 'Disable on mobile devices', 'contextual-related-posts' ),
@@ -284,6 +306,18 @@ function crp_settings_output() {
284
  'type' => 'posttypes',
285
  'options' => '',
286
  ),
 
 
 
 
 
 
 
 
 
 
 
 
287
  'html_wrapper_header' => array(
288
  'id' => 'html_wrapper_header',
289
  'name' => '<h3>' . esc_html__( 'HTML to display', 'contextual-related-posts' ) . '</h3>',
@@ -341,7 +375,7 @@ function crp_settings_output() {
341
  function crp_settings_list() {
342
 
343
  $settings = array(
344
- 'limit' => array(
345
  'id' => 'limit',
346
  'name' => esc_html__( 'Number of posts to display', 'contextual-related-posts' ),
347
  'desc' => esc_html__( 'Maximum number of posts that will be displayed in the list. This option is used if you do not specify the number of posts in the widget or shortcodes', 'contextual-related-posts' ),
@@ -350,7 +384,7 @@ function crp_settings_list() {
350
  'min' => '0',
351
  'size' => 'small',
352
  ),
353
- 'daily_range' => array(
354
  'id' => 'daily_range',
355
  'name' => esc_html__( 'Related posts should be newer than', 'contextual-related-posts' ),
356
  'desc' => esc_html__( 'This sets the cut-off period for which posts will be displayed. e.g. setting it to 365 will show related posts from the last year only. Set to 0 to disable limiting posts by date.', 'contextual-related-posts' ),
@@ -358,7 +392,7 @@ function crp_settings_list() {
358
  'options' => '1095',
359
  'min' => '0',
360
  ),
361
- 'ordering' => array(
362
  'id' => 'ordering',
363
  'name' => esc_html__( 'Order posts', 'contextual-related-posts' ),
364
  'desc' => '',
@@ -366,21 +400,21 @@ function crp_settings_list() {
366
  'default' => 'relevance',
367
  'options' => crp_get_orderings(),
368
  ),
369
- 'random_order' => array(
370
  'id' => 'random_order',
371
  'name' => esc_html__( 'Randomize posts', 'contextual-related-posts' ),
372
  'desc' => esc_html__( 'This shuffles the selected related posts. If you select to order by date in the previous option, then the related posts will first be sorted by date and the selected ones are shuffled. Does not work if Cache HTML output is enabled.', 'contextual-related-posts' ),
373
  'type' => 'checkbox',
374
  'options' => false,
375
  ),
376
- 'match_content' => array(
377
  'id' => 'match_content',
378
  'name' => esc_html__( 'Related posts based on title and content', 'contextual-related-posts' ),
379
  'desc' => esc_html__( 'If unchecked, only posts titles are used. Enable the cache if enabling this option for better performance. Each site is different, so toggle this option to see which setting gives you better quality related posts.', 'contextual-related-posts' ),
380
  'type' => 'checkbox',
381
  'options' => false,
382
  ),
383
- 'match_content_words' => array(
384
  'id' => 'match_content_words',
385
  'name' => esc_html__( 'Limit content to be compared', 'contextual-related-posts' ),
386
  /* translators: 1: Number. */
@@ -390,35 +424,35 @@ function crp_settings_list() {
390
  'min' => '0',
391
  'max' => CRP_MAX_WORDS,
392
  ),
393
- 'post_types' => array(
394
  'id' => 'post_types',
395
  'name' => esc_html__( 'Post types to include', 'contextual-related-posts' ),
396
  'desc' => esc_html__( 'At least one option should be selected above. Select which post types you want to include in the list of posts. This field can be overridden using a comma separated list of post types when using the manual display.', 'contextual-related-posts' ),
397
  'type' => 'posttypes',
398
  'options' => 'post,page',
399
  ),
400
- 'same_post_type' => array(
401
  'id' => 'same_post_type',
402
  'name' => esc_html__( 'Limit to same post type', 'contextual-related-posts' ),
403
  'desc' => esc_html__( 'If checked, the related posts will only be selected from the same post type of the current post.', 'contextual-related-posts' ),
404
  'type' => 'checkbox',
405
  'options' => false,
406
  ),
407
- 'same_author' => array(
408
  'id' => 'same_author',
409
  'name' => esc_html__( 'Limit to same author', 'contextual-related-posts' ),
410
  'desc' => esc_html__( 'If checked, the related posts will only be selected from the same author of the current post.', 'contextual-related-posts' ),
411
  'type' => 'checkbox',
412
  'options' => false,
413
  ),
414
- 'exclude_post_ids' => array(
415
  'id' => 'exclude_post_ids',
416
  'name' => esc_html__( 'Post/page IDs to exclude', 'contextual-related-posts' ),
417
  'desc' => esc_html__( 'Comma-separated list of post or page IDs to exclude from the list. e.g. 188,320,500', 'contextual-related-posts' ),
418
  'type' => 'numbercsv',
419
  'options' => '',
420
  ),
421
- 'exclude_cat_slugs' => array(
422
  'id' => 'exclude_cat_slugs',
423
  'name' => esc_html__( 'Exclude Categories', 'contextual-related-posts' ),
424
  'desc' => esc_html__( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support custom taxonomies.', 'contextual-related-posts' ),
@@ -430,7 +464,7 @@ function crp_settings_list() {
430
  'data-wp-taxonomy' => 'category',
431
  ),
432
  ),
433
- 'exclude_categories' => array(
434
  'id' => 'exclude_categories',
435
  'name' => esc_html__( 'Exclude category IDs', 'contextual-related-posts' ),
436
  'desc' => esc_html__( 'This is a readonly field that is automatically populated based on the above input when the settings are saved. These might differ from the IDs visible in the Categories page which use the term_id. Contextual Related Posts uses the term_taxonomy_id which is unique to this taxonomy.', 'contextual-related-posts' ),
@@ -438,6 +472,20 @@ function crp_settings_list() {
438
  'options' => '',
439
  'readonly' => true,
440
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  );
442
 
443
  /**
@@ -759,7 +807,22 @@ function crp_get_styles() {
759
  array(
760
  'id' => 'rounded_thumbs',
761
  'name' => esc_html__( 'Rounded thumbnails', 'contextual-related-posts' ),
762
- 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/crp-rounded-thumbs.png', CRP_PLUGIN_FILE ) ) . '" width="350" /> <br />' . esc_html__( 'Enabling this option will turn on the thumbnails and force their width and height. It will also turn off the display of the author, excerpt and date if already enabled. Disabling this option will not revert any settings.', 'contextual-related-posts' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
763
  ),
764
  );
765
 
106
  'options' => '-1',
107
  'min' => '-1',
108
  ),
109
+ 'same_taxes' => array(
110
+ 'id' => 'same_taxes',
111
+ 'name' => esc_html__( 'Only from same', 'crp-taxonomy' ),
112
+ 'desc' => esc_html__( 'Limit the related posts only to the categories, tags, and/or taxonomies of the current post.', 'crp-taxonomy' ),
113
+ 'type' => 'taxonomies',
114
+ 'options' => '',
115
+ ),
116
+ 'match_all' => array(
117
+ 'id' => 'match_all',
118
+ 'name' => esc_html__( 'Match all taxonomies', 'crp-taxonomy' ),
119
+ 'desc' => esc_html__( 'If enabled, then it will only select posts that match all the above selected taxonomies. This can result in no related posts being found.', 'crp-taxonomy' ),
120
+ 'type' => 'checkbox',
121
+ 'options' => false,
122
+ ),
123
+ 'no_of_common_terms' => array(
124
+ 'id' => 'no_of_common_terms',
125
+ 'name' => esc_html__( 'Number of common terms', 'crp-taxonomy' ),
126
+ 'desc' => esc_html__( 'Enter the minimum number of common terms that have to be matched before a post is considered related.', 'crp-taxonomy' ),
127
+ 'type' => 'number',
128
+ 'options' => '1',
129
+ 'min' => '1',
130
+ ),
131
  'disable_on_mobile' => array(
132
  'id' => 'disable_on_mobile',
133
  'name' => esc_html__( 'Disable on mobile devices', 'contextual-related-posts' ),
306
  'type' => 'posttypes',
307
  'options' => '',
308
  ),
309
+ 'exclude_on_cat_slugs' => array(
310
+ 'id' => 'exclude_on_cat_slugs',
311
+ 'name' => esc_html__( 'Exclude on Categories', 'crp-taxonomy' ),
312
+ 'desc' => esc_html__( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support custom taxonomies.', 'crp-taxonomy' ),
313
+ 'type' => 'csv',
314
+ 'options' => '',
315
+ 'size' => 'large',
316
+ 'field_class' => 'category_autocomplete',
317
+ 'field_attributes' => array(
318
+ 'data-wp-taxonomy' => 'category',
319
+ ),
320
+ ),
321
  'html_wrapper_header' => array(
322
  'id' => 'html_wrapper_header',
323
  'name' => '<h3>' . esc_html__( 'HTML to display', 'contextual-related-posts' ) . '</h3>',
375
  function crp_settings_list() {
376
 
377
  $settings = array(
378
+ 'limit' => array(
379
  'id' => 'limit',
380
  'name' => esc_html__( 'Number of posts to display', 'contextual-related-posts' ),
381
  'desc' => esc_html__( 'Maximum number of posts that will be displayed in the list. This option is used if you do not specify the number of posts in the widget or shortcodes', 'contextual-related-posts' ),
384
  'min' => '0',
385
  'size' => 'small',
386
  ),
387
+ 'daily_range' => array(
388
  'id' => 'daily_range',
389
  'name' => esc_html__( 'Related posts should be newer than', 'contextual-related-posts' ),
390
  'desc' => esc_html__( 'This sets the cut-off period for which posts will be displayed. e.g. setting it to 365 will show related posts from the last year only. Set to 0 to disable limiting posts by date.', 'contextual-related-posts' ),
392
  'options' => '1095',
393
  'min' => '0',
394
  ),
395
+ 'ordering' => array(
396
  'id' => 'ordering',
397
  'name' => esc_html__( 'Order posts', 'contextual-related-posts' ),
398
  'desc' => '',
400
  'default' => 'relevance',
401
  'options' => crp_get_orderings(),
402
  ),
403
+ 'random_order' => array(
404
  'id' => 'random_order',
405
  'name' => esc_html__( 'Randomize posts', 'contextual-related-posts' ),
406
  'desc' => esc_html__( 'This shuffles the selected related posts. If you select to order by date in the previous option, then the related posts will first be sorted by date and the selected ones are shuffled. Does not work if Cache HTML output is enabled.', 'contextual-related-posts' ),
407
  'type' => 'checkbox',
408
  'options' => false,
409
  ),
410
+ 'match_content' => array(
411
  'id' => 'match_content',
412
  'name' => esc_html__( 'Related posts based on title and content', 'contextual-related-posts' ),
413
  'desc' => esc_html__( 'If unchecked, only posts titles are used. Enable the cache if enabling this option for better performance. Each site is different, so toggle this option to see which setting gives you better quality related posts.', 'contextual-related-posts' ),
414
  'type' => 'checkbox',
415
  'options' => false,
416
  ),
417
+ 'match_content_words' => array(
418
  'id' => 'match_content_words',
419
  'name' => esc_html__( 'Limit content to be compared', 'contextual-related-posts' ),
420
  /* translators: 1: Number. */
424
  'min' => '0',
425
  'max' => CRP_MAX_WORDS,
426
  ),
427
+ 'post_types' => array(
428
  'id' => 'post_types',
429
  'name' => esc_html__( 'Post types to include', 'contextual-related-posts' ),
430
  'desc' => esc_html__( 'At least one option should be selected above. Select which post types you want to include in the list of posts. This field can be overridden using a comma separated list of post types when using the manual display.', 'contextual-related-posts' ),
431
  'type' => 'posttypes',
432
  'options' => 'post,page',
433
  ),
434
+ 'same_post_type' => array(
435
  'id' => 'same_post_type',
436
  'name' => esc_html__( 'Limit to same post type', 'contextual-related-posts' ),
437
  'desc' => esc_html__( 'If checked, the related posts will only be selected from the same post type of the current post.', 'contextual-related-posts' ),
438
  'type' => 'checkbox',
439
  'options' => false,
440
  ),
441
+ 'same_author' => array(
442
  'id' => 'same_author',
443
  'name' => esc_html__( 'Limit to same author', 'contextual-related-posts' ),
444
  'desc' => esc_html__( 'If checked, the related posts will only be selected from the same author of the current post.', 'contextual-related-posts' ),
445
  'type' => 'checkbox',
446
  'options' => false,
447
  ),
448
+ 'exclude_post_ids' => array(
449
  'id' => 'exclude_post_ids',
450
  'name' => esc_html__( 'Post/page IDs to exclude', 'contextual-related-posts' ),
451
  'desc' => esc_html__( 'Comma-separated list of post or page IDs to exclude from the list. e.g. 188,320,500', 'contextual-related-posts' ),
452
  'type' => 'numbercsv',
453
  'options' => '',
454
  ),
455
+ 'exclude_cat_slugs' => array(
456
  'id' => 'exclude_cat_slugs',
457
  'name' => esc_html__( 'Exclude Categories', 'contextual-related-posts' ),
458
  'desc' => esc_html__( 'Comma separated list of category slugs. The field above has an autocomplete so simply start typing in the starting letters and it will prompt you with options. Does not support custom taxonomies.', 'contextual-related-posts' ),
464
  'data-wp-taxonomy' => 'category',
465
  ),
466
  ),
467
+ 'exclude_categories' => array(
468
  'id' => 'exclude_categories',
469
  'name' => esc_html__( 'Exclude category IDs', 'contextual-related-posts' ),
470
  'desc' => esc_html__( 'This is a readonly field that is automatically populated based on the above input when the settings are saved. These might differ from the IDs visible in the Categories page which use the term_id. Contextual Related Posts uses the term_taxonomy_id which is unique to this taxonomy.', 'contextual-related-posts' ),
472
  'options' => '',
473
  'readonly' => true,
474
  ),
475
+ 'disable_contextual' => array(
476
+ 'id' => 'disable_contextual',
477
+ 'name' => esc_html__( 'Disable contextual matching', 'crp-taxonomy' ),
478
+ 'desc' => esc_html__( 'Selecting this option will turn off contextual matching. This is only useful if you activate the option: "Only from same" from the General tab. Otherwise, you will end up with the same set of related posts on all pages with no relevance.', 'crp-taxonomy' ),
479
+ 'type' => 'checkbox',
480
+ 'options' => false,
481
+ ),
482
+ 'disable_contextual_cpt' => array(
483
+ 'id' => 'disable_contextual_cpt',
484
+ 'name' => esc_html__( 'Disable contextual matching ONLY on attachments and custom post types', 'crp-taxonomy' ),
485
+ 'desc' => esc_html__( 'Applies only if the previous option is checked. Selecting this option will retain contextual matching for posts and pages but disable this on any custom post types.', 'crp-taxonomy' ),
486
+ 'type' => 'checkbox',
487
+ 'options' => true,
488
+ ),
489
  );
490
 
491
  /**
807
  array(
808
  'id' => 'rounded_thumbs',
809
  'name' => esc_html__( 'Rounded thumbnails', 'contextual-related-posts' ),
810
+ 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/rounded-thumbs.png', CRP_PLUGIN_FILE ) ) . '" width="500" /> <br />' . esc_html__( 'Enabling this option will turn on the thumbnails. It will also turn off the display of the author, excerpt and date if already enabled. Disabling this option will not revert any settings.', 'contextual-related-posts' ) . '<br />',
811
+ ),
812
+ array(
813
+ 'id' => 'masonry',
814
+ 'name' => esc_html__( 'Masonry', 'contextual-related-posts' ),
815
+ 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/masonry.png', CRP_PLUGIN_FILE ) ) . '" width="500" /> <br />' . esc_html__( 'Enables a masonry style layout similar to one made famous by Pinterest.', 'contextual-related-posts' ) . '<br />',
816
+ ),
817
+ array(
818
+ 'id' => 'grid',
819
+ 'name' => esc_html__( 'Grid', 'contextual-related-posts' ),
820
+ 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/grid.png', CRP_PLUGIN_FILE ) ) . '" width="500" /> <br />' . esc_html__( 'Uses CSS Grid for display. Might not work on older browsers.', 'contextual-related-posts' ) . '<br />',
821
+ ),
822
+ array(
823
+ 'id' => 'thumbs_grid',
824
+ 'name' => esc_html__( 'Rounded thumbnails with CSS grid', 'contextual-related-posts' ),
825
+ 'description' => '<br /><img src="' . esc_url( plugins_url( 'includes/admin/images/thumbs-grid.png', CRP_PLUGIN_FILE ) ) . '" width="500" /> <br />' . esc_html__( 'Uses CSS grid. It will also turn off the display of the author, excerpt and date if already enabled. Disabling this option will not revert any settings.', 'contextual-related-posts' ) . '<br />',
826
  ),
827
  );
828
 
includes/admin/help-tab.php CHANGED
@@ -22,22 +22,16 @@ if ( ! defined( 'WPINC' ) ) {
22
  * @since 2.6.0
23
  */
24
  function crp_settings_help() {
25
- global $crp_settings_page;
26
-
27
  $screen = get_current_screen();
28
 
29
- if ( $screen->id !== $crp_settings_page ) {
30
- return;
31
- }
32
-
33
  $screen->set_help_sidebar(
34
  /* translators: 1: Support link. */
35
- '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s">WebberZone support site</a>.', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
36
  /* translators: 1: Forum link. */
37
- '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s">WordPress.org support forums</a>.', 'contextual-related-posts' ), esc_url( 'https://wordpress.org/support/plugin/contextual-related-posts' ) ) . '</p>' .
38
  '<p>' . sprintf(
39
  /* translators: 1: Github Issues link, 2: Github page. */
40
- __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'contextual-related-posts' ),
41
  esc_url( 'https://github.com/WebberZone/contextual-related-posts/issues' ),
42
  esc_url( 'https://github.com/WebberZone/contextual-related-posts' )
43
  ) . '</p>'
@@ -45,61 +39,30 @@ function crp_settings_help() {
45
 
46
  $screen->add_help_tab(
47
  array(
48
- 'id' => 'crp-settings-general',
49
- 'title' => __( 'General', 'contextual-related-posts' ),
50
- 'content' =>
51
- '<p>' . __( 'This screen provides the basic settings for configuring Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
52
- '<p>' . __( 'Enable the trackers and cache, configure basic tracker settings and uninstall settings.', 'contextual-related-posts' ) . '</p>',
53
- )
54
- );
55
-
56
- $screen->add_help_tab(
57
- array(
58
- 'id' => 'crp-settings-counter',
59
- 'title' => __( 'Counter/Tracker', 'contextual-related-posts' ),
60
- 'content' =>
61
- '<p>' . __( 'This screen provides settings to tweak the display counter and the tracker.', 'contextual-related-posts' ) . '</p>' .
62
- '<p>' . __( 'Choose where to display the counter and customize the text. Select the type of tracker and which user groups to track.', 'contextual-related-posts' ) . '</p>',
63
- )
64
- );
65
-
66
- $screen->add_help_tab(
67
- array(
68
- 'id' => 'crp-settings-list',
69
- 'title' => __( 'Posts list', 'contextual-related-posts' ),
70
  'content' =>
71
- '<p>' . __( 'This screen provides settings to tweak the output of the list of related posts.', 'contextual-related-posts' ) . '</p>' .
72
- '<p>' . __( 'Set the number of posts, which categories or posts to exclude, customize what to display and specific basic HTML markup used to create the posts.', 'contextual-related-posts' ) . '</p>',
 
 
 
 
73
  )
74
  );
75
 
76
  $screen->add_help_tab(
77
  array(
78
- 'id' => 'crp-settings-thumbnail',
79
- 'title' => __( 'Thumbnail', 'contextual-related-posts' ),
80
  'content' =>
81
- '<p>' . __( 'This screen provides settings to tweak the thumbnail that can be displayed for each post in the list.', 'contextual-related-posts' ) . '</p>' .
82
- '<p>' . __( 'Set the location and size of the thumbnail. Additionally, you can choose additional sources for the thumbnail i.e. a meta field, first image or a default thumbnail when nothing is available.', 'contextual-related-posts' ) . '</p>',
83
- )
84
- );
85
-
86
- $screen->add_help_tab(
87
- array(
88
- 'id' => 'crp-settings-styles',
89
- 'title' => __( 'Styles', 'contextual-related-posts' ),
90
- 'content' =>
91
- '<p>' . __( 'This screen provides options to control the look and feel of the related posts list.', 'contextual-related-posts' ) . '</p>' .
92
- '<p>' . __( 'Choose for default set of styles or add your own custom CSS to tweak the display of the posts.', 'contextual-related-posts' ) . '</p>',
93
- )
94
- );
95
-
96
- $screen->add_help_tab(
97
- array(
98
- 'id' => 'crp-settings-maintenance',
99
- 'title' => __( 'Maintenance', 'contextual-related-posts' ),
100
- 'content' =>
101
- '<p>' . __( 'This screen provides options to control the maintenance cron.', 'contextual-related-posts' ) . '</p>' .
102
- '<p>' . __( 'Choose how often to run maintenance and at what time of the day.', 'contextual-related-posts' ) . '</p>',
103
  )
104
  );
105
 
@@ -107,42 +70,3 @@ function crp_settings_help() {
107
 
108
  }
109
 
110
- /**
111
- * Generates the Tools help page.
112
- *
113
- * @since 2.6.0
114
- */
115
- function crp_settings_tools_help() {
116
- global $crp_settings_tools_help;
117
-
118
- $screen = get_current_screen();
119
-
120
- if ( $screen->id !== $crp_settings_tools_help ) {
121
- return;
122
- }
123
-
124
- $screen->set_help_sidebar(
125
- /* translators: 1: Support link. */
126
- '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s">WebberZone support site</a>.', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
127
- /* translators: 1: Forum link. */
128
- '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s">WordPress.org support forums</a>.', 'contextual-related-posts' ), esc_url( 'https://wordpress.org/support/plugin/contextual-related-posts' ) ) . '</p>' .
129
- '<p>' . sprintf(
130
- /* translators: 1: Github Issues link, 2: Github page. */
131
- __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'contextual-related-posts' ),
132
- esc_url( 'https://github.com/WebberZone/contextual-related-posts/issues' ),
133
- esc_url( 'https://github.com/WebberZone/contextual-related-posts' )
134
- ) . '</p>'
135
- );
136
-
137
- $screen->add_help_tab(
138
- array(
139
- 'id' => 'crp-settings-general',
140
- 'title' => __( 'General', 'contextual-related-posts' ),
141
- 'content' =>
142
- '<p>' . __( 'This screen provides some tools that help maintain certain features of Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
143
- '<p>' . __( 'Clear the cache, reset the related posts tables plus some miscellaneous fixes for older versions of Contextual Related Posts.', 'contextual-related-posts' ) . '</p>',
144
- )
145
- );
146
-
147
- do_action( 'crp_settings_tools_help', $screen );
148
- }
22
  * @since 2.6.0
23
  */
24
  function crp_settings_help() {
 
 
25
  $screen = get_current_screen();
26
 
 
 
 
 
27
  $screen->set_help_sidebar(
28
  /* translators: 1: Support link. */
29
+ '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%1$s" target="_blank">WebberZone support site</a>.', 'contextual-related-posts' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
30
  /* translators: 1: Forum link. */
31
+ '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%1$s" target="_blank">WordPress.org support forums</a>.', 'contextual-related-posts' ), esc_url( 'https://wordpress.org/support/plugin/contextual-related-posts' ) ) . '</p>' .
32
  '<p>' . sprintf(
33
  /* translators: 1: Github Issues link, 2: Github page. */
34
+ __( '<a href="%1$s" target="_blank">Post an issue</a> on <a href="%2$s" target="_blank">GitHub</a> (bug reports only).', 'contextual-related-posts' ),
35
  esc_url( 'https://github.com/WebberZone/contextual-related-posts/issues' ),
36
  esc_url( 'https://github.com/WebberZone/contextual-related-posts' )
37
  ) . '</p>'
39
 
40
  $screen->add_help_tab(
41
  array(
42
+ 'id' => 'crp-settings',
43
+ 'title' => __( 'Settings', 'contextual-related-posts' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  'content' =>
45
+ '<p>' . __( 'This screen provides the various settings for configuring Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
46
+ '<p>' . sprintf(
47
+ /* translators: 1: Link to Knowledge Base article. */
48
+ __( 'You can find detailed information on each of the settings in these <a href="%1$s" target="_blank">knowledgebase articles</a>.', 'contextual-related-posts' ),
49
+ esc_url( 'https://webberzone.com/support/section/contextual-related-posts/01-crp-getting-started/' ),
50
+ ) . '</p>',
51
  )
52
  );
53
 
54
  $screen->add_help_tab(
55
  array(
56
+ 'id' => 'crp-settings-tools',
57
+ 'title' => __( 'Tools', 'contextual-related-posts' ),
58
  'content' =>
59
+ '<p>' . __( 'This screen provides some tools that help maintain certain features of Contextual Related Posts.', 'contextual-related-posts' ) . '</p>' .
60
+ '<p>' . __( 'Clear the cache, recreate the fulltext indices (including code to manually run this in phpMyAdmin), export/import settings and delete the older settings.', 'contextual-related-posts' ) . '</p>' .
61
+ '<p>' . sprintf(
62
+ /* translators: 1: Link to Knowledge Base article. */
63
+ __( 'You can find more information on each of these tools in this <a href="%1$s" target="_blank">knowledgebase article</a>.', 'contextual-related-posts' ),
64
+ esc_url( 'https://webberzone.com/support/knowledgebase/contextual-related-posts-settings-tools/' ),
65
+ ) . '</p>',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  )
67
  );
68
 
70
 
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/images/grid.png ADDED
Binary file
includes/admin/images/masonry.png ADDED
Binary file
includes/admin/images/{crp-rounded-thumbs.png → rounded-thumbs.png} RENAMED
File without changes
includes/admin/images/thumbs-grid.png ADDED
Binary file
includes/admin/modules/cache.php DELETED
@@ -1,188 +0,0 @@
1
- <?php
2
- /**
3
- * Contextual Related Posts Cache interface.
4
- *
5
- * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
- */
11
-
12
- // If this file is called directly, abort.
13
- if ( ! defined( 'WPINC' ) ) {
14
- die;
15
- }
16
-
17
- /**
18
- * Function to clear the CRP Cache with Ajax.
19
- *
20
- * @since 1.8.10
21
- */
22
- function crp_ajax_clearcache() {
23
-
24
- global $wpdb;
25
-
26
- $meta_keys = crp_cache_get_keys();
27
- $error = false;
28
-
29
- foreach ( $meta_keys as $meta_key ) {
30
-
31
- $count = $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
32
- $wpdb->prepare(
33
- "
34
- DELETE FROM {$wpdb->postmeta}
35
- WHERE meta_key = %s
36
- ",
37
- $meta_key
38
- )
39
- );
40
-
41
- if ( false === $count ) {
42
- $error = true;
43
- } else {
44
- $counter[] = $count;
45
- }
46
- }
47
-
48
- /**** Did an error occur? */
49
- if ( $error ) {
50
- exit(
51
- wp_json_encode(
52
- array(
53
- 'success' => 0,
54
- 'message' => __( 'An error occurred clearing the cache. Please contact your site administrator.\n\nError message:\n', 'contextual-related-posts' ) . $wpdb->print_error(),
55
- )
56
- )
57
- );
58
- } else { // No error, return the number of.
59
- exit(
60
- wp_json_encode(
61
- array(
62
- 'success' => 1,
63
- 'message' => ( array_sum( $counter ) ) . __( ' cached row(s) cleared', 'contextual-related-posts' ),
64
- )
65
- )
66
- );
67
- }
68
- }
69
- add_action( 'wp_ajax_crp_clear_cache', 'crp_ajax_clearcache' );
70
-
71
-
72
- /**
73
- * Delete the CRP cache.
74
- *
75
- * @since 2.2.0
76
- *
77
- * @param array $meta_keys Array of meta keys that hold the cache.
78
- */
79
- function crp_cache_delete( $meta_keys = array() ) {
80
-
81
- $default_meta_keys = crp_cache_get_keys();
82
-
83
- if ( ! empty( $meta_keys ) ) {
84
- $meta_keys = array_intersect( $default_meta_keys, (array) $meta_keys );
85
- } else {
86
- $meta_keys = $default_meta_keys;
87
- }
88
-
89
- foreach ( $meta_keys as $meta_key ) {
90
- delete_post_meta_by_key( $meta_key );
91
- }
92
- }
93
-
94
-
95
- /**
96
- * Get the default meta keys used for the cache
97
- *
98
- * @since 2.2.0
99
- */
100
- function crp_cache_get_keys() {
101
-
102
- $meta_keys = array(
103
- 'crp_related_posts',
104
- 'crp_related_posts_widget',
105
- 'crp_related_posts_feed',
106
- 'crp_related_posts_widget_feed',
107
- 'crp_related_posts_manual',
108
- 'crp_related_posts_block',
109
- );
110
-
111
- $meta_keys = array_merge( $meta_keys, crp_cache_get_meta_keys() );
112
-
113
- /**
114
- * Filters the array containing the various cache keys.
115
- *
116
- * @since 1.9
117
- *
118
- * @param array $default_meta_keys Array of meta keys
119
- */
120
- return apply_filters( 'crp_cache_keys', $meta_keys );
121
- }
122
-
123
-
124
- /**
125
- * Get the _crp_cache keys.
126
- *
127
- * @since 2.7.0
128
- *
129
- * @return array Array of _crp_cache keys.
130
- */
131
- function crp_cache_get_meta_keys() {
132
- global $wpdb;
133
-
134
- $keys = array();
135
-
136
- $sql = "
137
- SELECT meta_key
138
- FROM {$wpdb->postmeta}
139
- WHERE `meta_key` LIKE '_crp_cache_%'
140
- ";
141
-
142
- $results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
143
-
144
- $keys = wp_list_pluck( $results, 'meta_key' );
145
-
146
- /**
147
- * Filter the array of _crp_cache keys.
148
- *
149
- * @since 2.7.0
150
- *
151
- * @return array Array of _crp_cache keys.
152
- */
153
- return apply_filters( 'crp_cache_get_meta_keys', $keys );
154
- }
155
-
156
- /**
157
- * Function to clear cache on post save.
158
- *
159
- * @since 2.5.0
160
- *
161
- * @param mixed $post_id Post ID.
162
- */
163
- function crp_delete_cache_post_save( $post_id ) {
164
-
165
- // Bail if we're doing an auto save.
166
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
167
- return;
168
- }
169
-
170
- // If our nonce isn't there, or we can't verify it, bail.
171
- if ( ! isset( $_POST['crp_meta_box_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['crp_meta_box_nonce'] ), 'crp_meta_box' ) ) {
172
- return;
173
- }
174
-
175
- // If our current user can't edit this post, bail.
176
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
177
- return;
178
- }
179
-
180
- // Clear cache of current post.
181
- $default_meta_keys = crp_cache_get_keys();
182
- foreach ( $default_meta_keys as $meta_key ) {
183
- delete_post_meta( $post_id, $meta_key );
184
- }
185
-
186
- }
187
- add_action( 'crp_save_meta_box', 'crp_delete_cache_post_save' );
188
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/modules/loader.php CHANGED
@@ -3,10 +3,6 @@
3
  * Contextual Related Posts Admin Loader.
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
3
  * Contextual Related Posts Admin Loader.
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
includes/admin/modules/metabox.php CHANGED
@@ -3,10 +3,6 @@
3
  * Contextual Related Posts Metabox interface.
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  /**** If this file is called directly, abort. ****/
3
  * Contextual Related Posts Metabox interface.
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  /**** If this file is called directly, abort. ****/
includes/admin/modules/tools.php CHANGED
@@ -163,13 +163,9 @@ function crp_recreate_indices_sql() {
163
  $sql .= '<br />';
164
  $sql .= "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title;";
165
  $sql .= '<br />';
166
- $sql .= "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_content;";
167
- $sql .= '<br />';
168
  $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related (post_title, post_content);";
169
  $sql .= '<br />';
170
  $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);";
171
- $sql .= '<br />';
172
- $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_content (post_content);";
173
 
174
  /**
175
  * Filters the SQL code to recreate the PRIMARY KEY.
163
  $sql .= '<br />';
164
  $sql .= "ALTER TABLE {$wpdb->posts} DROP INDEX crp_related_title;";
165
  $sql .= '<br />';
 
 
166
  $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related (post_title, post_content);";
167
  $sql .= '<br />';
168
  $sql .= "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);";
 
 
169
 
170
  /**
171
  * Filters the SQL code to recreate the PRIMARY KEY.
includes/admin/register-settings.php CHANGED
@@ -33,6 +33,10 @@ function crp_get_option( $key = '', $default = null ) {
33
 
34
  global $crp_settings;
35
 
 
 
 
 
36
  if ( is_null( $default ) ) {
37
  $default = crp_get_default_option( $key );
38
  }
@@ -261,7 +265,7 @@ function crp_settings_defaults() {
261
  $options[ $option['id'] ] = 0;
262
  }
263
  // If an option is set.
264
- if ( in_array( $option['type'], array( 'textarea', 'text', 'csv', 'numbercsv', 'posttypes', 'number' ), true ) && isset( $option['options'] ) ) {
265
  $options[ $option['id'] ] = $option['options'];
266
  }
267
  if ( in_array( $option['type'], array( 'multicheck', 'radio', 'select', 'radiodesc', 'thumbsizes' ), true ) && isset( $option['default'] ) ) {
33
 
34
  global $crp_settings;
35
 
36
+ if ( empty( $crp_settings ) ) {
37
+ $crp_settings = crp_get_settings();
38
+ }
39
+
40
  if ( is_null( $default ) ) {
41
  $default = crp_get_default_option( $key );
42
  }
265
  $options[ $option['id'] ] = 0;
266
  }
267
  // If an option is set.
268
+ if ( in_array( $option['type'], array( 'textarea', 'text', 'csv', 'numbercsv', 'posttypes', 'number', 'css' ), true ) && isset( $option['options'] ) ) {
269
  $options[ $option['id'] ] = $option['options'];
270
  }
271
  if ( in_array( $option['type'], array( 'multicheck', 'radio', 'select', 'radiodesc', 'thumbsizes' ), true ) && isset( $option['default'] ) ) {
includes/admin/save-settings.php CHANGED
@@ -118,7 +118,7 @@ function crp_settings_sanitize( $input = array() ) {
118
  add_settings_error( 'crp-notices', 'crp-updated', __( 'Settings updated.', 'contextual-related-posts' ), 'updated' );
119
 
120
  // Overwrite settings if rounded thumbnail style is selected.
121
- if ( 'rounded_thumbs' === $output['crp_styles'] ) {
122
  add_settings_error( 'crp-notices', 'crp-styles', __( 'Rounded Thumbnails style selected in Styles tab. Post author, excerpt and date disabled. Thumbnail location set to either "inline before text" or "only thumbnails, no text".', 'contextual-related-posts' ), 'updated' );
123
  }
124
  // Overwrite settings if text_only thumbnail style is selected.
@@ -334,8 +334,26 @@ function crp_change_settings_on_save( $settings ) {
334
  $settings['exclude_cat_slugs'] = isset( $exclude_categories_slugs ) ? crp_str_putcsv( $exclude_categories_slugs ) : '';
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  // Overwrite settings if rounded thumbnail style is selected.
338
- if ( 'rounded_thumbs' === $settings['crp_styles'] ) {
339
  $settings['show_excerpt'] = 0;
340
  $settings['show_author'] = 0;
341
  $settings['show_date'] = 0;
118
  add_settings_error( 'crp-notices', 'crp-updated', __( 'Settings updated.', 'contextual-related-posts' ), 'updated' );
119
 
120
  // Overwrite settings if rounded thumbnail style is selected.
121
+ if ( 'rounded_thumbs' === $output['crp_styles'] || 'thumbs_grid' === $output['crp_styles'] ) {
122
  add_settings_error( 'crp-notices', 'crp-styles', __( 'Rounded Thumbnails style selected in Styles tab. Post author, excerpt and date disabled. Thumbnail location set to either "inline before text" or "only thumbnails, no text".', 'contextual-related-posts' ), 'updated' );
123
  }
124
  // Overwrite settings if text_only thumbnail style is selected.
334
  $settings['exclude_cat_slugs'] = isset( $exclude_categories_slugs ) ? crp_str_putcsv( $exclude_categories_slugs ) : '';
335
  }
336
 
337
+ // Sanitize exclude_on_cat_slugs to save a new entry of exclude_on_categories.
338
+ if ( isset( $settings['exclude_on_cat_slugs'] ) ) {
339
+
340
+ $exclude_on_cat_slugs = array_unique( str_getcsv( $settings['exclude_on_cat_slugs'] ) );
341
+
342
+ foreach ( $exclude_on_cat_slugs as $cat_name ) {
343
+ $cat = get_term_by( 'name', $cat_name, 'category' );
344
+
345
+ if ( isset( $cat->term_taxonomy_id ) ) {
346
+ $exclude_on_categories[] = $cat->term_taxonomy_id;
347
+ $exclude_on_categories_slugs[] = $cat->name;
348
+ }
349
+ }
350
+ $settings['exclude_on_categories'] = isset( $exclude_on_categories ) ? join( ',', $exclude_on_categories ) : '';
351
+ $settings['exclude_on_cat_slugs'] = isset( $exclude_on_categories_slugs ) ? crp_str_putcsv( $exclude_on_categories_slugs ) : '';
352
+
353
+ }
354
+
355
  // Overwrite settings if rounded thumbnail style is selected.
356
+ if ( 'rounded_thumbs' === $settings['crp_styles'] || 'thumbs_grid' === $settings['crp_styles'] ) {
357
  $settings['show_excerpt'] = 0;
358
  $settings['show_author'] = 0;
359
  $settings['show_date'] = 0;
includes/admin/settings-page.php CHANGED
@@ -642,8 +642,7 @@ function crp_taxonomies_callback( $args ) {
642
 
643
  /* Fetch taxonomies */
644
  $argsc = array(
645
- 'public' => true,
646
- '_builtin' => true,
647
  );
648
  $output = 'objects';
649
  $operator = 'and';
@@ -656,7 +655,7 @@ function crp_taxonomies_callback( $args ) {
656
  foreach ( $wp_taxonomies as $wp_taxonomy ) {
657
 
658
  $html .= sprintf( '<input name="crp_settings[%1$s][%2$s]" id="crp_settings[%1$s][%2$s]" type="checkbox" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), checked( true, in_array( $wp_taxonomy->name, $taxonomies_inc, true ), false ) );
659
- $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s</label> <br />', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), $wp_taxonomy->labels->name );
660
 
661
  }
662
 
@@ -766,11 +765,11 @@ function crp_styles_messages( $html, $args ) {
766
 
767
  $crp_styles = crp_get_option( 'crp_styles' );
768
 
769
- if ( 'rounded_thumbs' === $crp_styles && ( 'show_excerpt' === $args['id'] || 'show_author' === $args['id'] || 'show_date' === $args['id'] ) ) {
770
  $html .= '<span style="color:red">' . esc_html__( 'This option cannot be changed because of the selected related posts style. To modify this option, you will need to select No styles or Text only in the Styles tab', 'contextual-related-posts' ) . '</span>';
771
  }
772
 
773
- if ( ( 'rounded_thumbs' === $crp_styles || 'text_only' === $crp_styles ) && 'post_thumb_op' === $args['id'] ) {
774
  $html .= '<span style="color:red">' . esc_html__( 'This option cannot be changed because of the selected related posts style. To modify this option, you will need to select No styles in the Styles tab', 'contextual-related-posts' ) . '</span>';
775
  }
776
 
642
 
643
  /* Fetch taxonomies */
644
  $argsc = array(
645
+ 'public' => true,
 
646
  );
647
  $output = 'objects';
648
  $operator = 'and';
655
  foreach ( $wp_taxonomies as $wp_taxonomy ) {
656
 
657
  $html .= sprintf( '<input name="crp_settings[%1$s][%2$s]" id="crp_settings[%1$s][%2$s]" type="checkbox" value="%2$s" %3$s /> ', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), checked( true, in_array( $wp_taxonomy->name, $taxonomies_inc, true ), false ) );
658
+ $html .= sprintf( '<label for="crp_settings[%1$s][%2$s]">%3$s (%4$s)</label> <br />', sanitize_key( $args['id'] ), esc_attr( $wp_taxonomy->name ), $wp_taxonomy->labels->name, $wp_taxonomy->name );
659
 
660
  }
661
 
765
 
766
  $crp_styles = crp_get_option( 'crp_styles' );
767
 
768
+ if ( in_array( $crp_styles, array( 'rounded_thumbs', 'thumbs_grid' ), true ) && ( 'show_excerpt' === $args['id'] || 'show_author' === $args['id'] || 'show_date' === $args['id'] ) ) {
769
  $html .= '<span style="color:red">' . esc_html__( 'This option cannot be changed because of the selected related posts style. To modify this option, you will need to select No styles or Text only in the Styles tab', 'contextual-related-posts' ) . '</span>';
770
  }
771
 
772
+ if ( in_array( $crp_styles, array( 'rounded_thumbs', 'thumbs_grid', 'text_only' ), true ) && 'post_thumb_op' === $args['id'] ) {
773
  $html .= '<span style="color:red">' . esc_html__( 'This option cannot be changed because of the selected related posts style. To modify this option, you will need to select No styles in the Styles tab', 'contextual-related-posts' ) . '</span>';
774
  }
775
 
includes/class-crp-query.php ADDED
@@ -0,0 +1,686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Query API: CRP_Query class
4
+ *
5
+ * @package Contextual_Related_Posts
6
+ * @subpackage CRP_Query
7
+ * @since 3.0.0
8
+ */
9
+
10
+ // If this file is called directly, abort.
11
+ if ( ! defined( 'WPINC' ) ) {
12
+ die;
13
+ }
14
+
15
+ if ( ! class_exists( 'CRP_Query' ) ) :
16
+ /**
17
+ * Query API: CRP_Query class.
18
+ *
19
+ * @since 3.0.0
20
+ */
21
+ class CRP_Query extends WP_Query {
22
+
23
+ /**
24
+ * Source Post to find related posts for.
25
+ *
26
+ * @var WP_Post A WP_Post instance.
27
+ */
28
+ public $source_post;
29
+
30
+ /**
31
+ * Query vars, after parsing
32
+ *
33
+ * @since 3.0.0
34
+ * @var array
35
+ */
36
+ public $query_args = array();
37
+
38
+ /**
39
+ * Flag to turn relevance matching ON or OFF.
40
+ *
41
+ * @since 3.0.0
42
+ * @var bool
43
+ */
44
+ public $enable_relevance = true;
45
+
46
+ /**
47
+ * Random order flag.
48
+ *
49
+ * @since 3.0.0
50
+ * @var bool
51
+ */
52
+ public $random_order = false;
53
+
54
+ /**
55
+ * Random order flag.
56
+ *
57
+ * @since 3.0.0
58
+ * @var mixed
59
+ */
60
+ public $crp_post_meta;
61
+
62
+ /**
63
+ * Random order flag.
64
+ *
65
+ * @since 3.0.0
66
+ * @var string
67
+ */
68
+ public $match_fields;
69
+
70
+ /**
71
+ * Random order flag.
72
+ *
73
+ * @since 3.0.0
74
+ * @var string
75
+ */
76
+ public $stuff;
77
+
78
+ /**
79
+ * Cache set flag.
80
+ *
81
+ * @since 3.0.0
82
+ * @var bool
83
+ */
84
+ public $in_cache = false;
85
+
86
+ /**
87
+ * Main constructor.
88
+ *
89
+ * @since 3.0.0
90
+ *
91
+ * @param array|string $args The Query variables. Accepts an array or a query string.
92
+ */
93
+ public function __construct( $args = array() ) {
94
+ $this->prepare_query_args( $args );
95
+
96
+ add_filter( 'posts_fields', array( $this, 'posts_fields' ), 10, 2 );
97
+ add_filter( 'posts_join', array( $this, 'posts_join' ), 10, 2 );
98
+ add_filter( 'posts_where', array( $this, 'posts_where' ), 10, 2 );
99
+ add_filter( 'posts_orderby', array( $this, 'posts_orderby' ), 10, 2 );
100
+ add_filter( 'posts_request', array( $this, 'posts_request' ), 10, 2 );
101
+ add_filter( 'posts_pre_query', array( $this, 'posts_pre_query' ), 10, 2 );
102
+ add_filter( 'the_posts', array( $this, 'the_posts' ), 10, 2 );
103
+
104
+ parent::__construct( $this->query_args );
105
+
106
+ // Remove filters after use.
107
+ remove_filter( 'posts_fields', array( $this, 'posts_fields' ) );
108
+ remove_filter( 'posts_join', array( $this, 'posts_join' ) );
109
+ remove_filter( 'posts_where', array( $this, 'posts_where' ) );
110
+ remove_filter( 'posts_orderby', array( $this, 'posts_orderby' ) );
111
+ remove_filter( 'posts_request', array( $this, 'posts_request' ) );
112
+ remove_filter( 'posts_pre_query', array( $this, 'posts_pre_query' ) );
113
+ remove_filter( 'the_posts', array( $this, 'the_posts' ) );
114
+ }
115
+
116
+ /**
117
+ * Prepare the query variables.
118
+ *
119
+ * @since 3.0.0
120
+ * @see WP_Query::parse_query()
121
+ * @see crp_get_registered_settings()
122
+ *
123
+ * @param string|array $args {
124
+ * Optional. Array or string of Query parameters.
125
+ *
126
+ * @type array|string $include_cat_ids An array or comma-separated string of category IDs.
127
+ * @type array|string $include_post_ids An array or comma-separated string of post IDs.
128
+ * @type bool $offset Offset the related posts returned by this number.
129
+ * @type int $postid Get related posts for a specific post ID.
130
+ * @type bool $strict_limit If this is set to false, then it will fetch 3x posts.
131
+ * }
132
+ */
133
+ public function prepare_query_args( $args = array() ) {
134
+ global $post;
135
+ $crp_settings = crp_get_settings();
136
+
137
+ $defaults = array(
138
+ 'include_cat_ids' => 0,
139
+ 'include_post_ids' => 0,
140
+ 'offset' => 0,
141
+ 'postid' => false,
142
+ 'strict_limit' => true,
143
+ );
144
+ $defaults = array_merge( $defaults, $crp_settings );
145
+ $args = wp_parse_args( $args, $defaults );
146
+
147
+ // Set necessary variables.
148
+ $args['crp_query'] = true;
149
+ $args['suppress_filters'] = false;
150
+ $args['ignore_sticky_posts'] = true;
151
+ $args['no_found_rows'] = true;
152
+
153
+ // Set the source post.
154
+ $source_post = empty( $args['postid'] ) ? $post : get_post( $args['postid'] );
155
+ if ( ! $source_post ) {
156
+ $source_post = $post;
157
+ }
158
+ $this->source_post = $source_post;
159
+
160
+ // Save post meta into a class-wide variable.
161
+ $this->crp_post_meta = get_post_meta( $source_post->ID, 'crp_post_meta', true );
162
+
163
+ // Set the random order and save it in a class-wide variable.
164
+ $random_order = ( $args['random_order'] || ( isset( $args['ordering'] ) && 'random' === $args['ordering'] ) ) ? true : false;
165
+ // If we need to order randomly then set strict_limit to false.
166
+ if ( $random_order ) {
167
+ $args['strict_limit'] = false;
168
+ }
169
+ $this->random_order = $random_order;
170
+
171
+ // Set the number of posts to be retrieved.
172
+ $args['posts_per_page'] = ( $args['strict_limit'] ) ? $args['limit'] : ( $args['limit'] * 3 );
173
+
174
+ // If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
175
+ if ( ! empty( $args['post_types'] ) && false === strpos( $args['post_types'], '=' ) ) {
176
+ $post_types = explode( ',', $args['post_types'] );
177
+ } else {
178
+ parse_str( $args['post_types'], $post_types ); // Save post types in $post_types variable.
179
+ }
180
+
181
+ // If post_types is empty or if we want all the post types.
182
+ if ( empty( $post_types ) || 'all' === $args['post_types'] ) {
183
+ $post_types = get_post_types(
184
+ array(
185
+ 'public' => true,
186
+ )
187
+ );
188
+ }
189
+
190
+ // If we only want posts from the same post type.
191
+ if ( $args['same_post_type'] ) {
192
+ $post_types = (array) $source_post->post_type;
193
+ }
194
+
195
+ // Tax Query.
196
+ if ( ! empty( $args['tax_query'] ) && is_array( $args['tax_query'] ) ) {
197
+ $tax_query = $args['tax_query'];
198
+ } else {
199
+ $tax_query = array();
200
+ }
201
+
202
+ if ( ! empty( $args['include_cat_ids'] ) ) {
203
+ $tax_query[] = array(
204
+ 'taxonomy' => 'category',
205
+ 'field' => 'term_taxonomy_id',
206
+ 'terms' => wp_parse_id_list( $args['include_cat_ids'] ),
207
+ );
208
+ }
209
+
210
+ if ( ! empty( $args['exclude_categories'] ) ) {
211
+ $tax_query[] = array(
212
+ 'taxonomy' => 'category',
213
+ 'field' => 'term_taxonomy_id',
214
+ 'terms' => wp_parse_id_list( $args['exclude_categories'] ),
215
+ 'operator' => 'NOT IN',
216
+ 'include_children' => false,
217
+ );
218
+ }
219
+
220
+ // Process same taxonomies option.
221
+ if ( isset( $args['same_taxes'] ) && $args['same_taxes'] ) {
222
+ $taxonomies = explode( ',', $args['same_taxes'] );
223
+
224
+ // Get the taxonomies used by the post type.
225
+ $post_taxonomies = get_object_taxonomies( $source_post );
226
+
227
+ // Only limit the taxonomies to what is selected for the current post.
228
+ $current_taxonomies = array_values( array_intersect( $taxonomies, $post_taxonomies ) );
229
+
230
+ // Store the number of common taxonomies.
231
+ $args['taxonomy_count'] = count( $current_taxonomies );
232
+
233
+ // Get the terms for the current post.
234
+ $terms = wp_get_object_terms( $source_post->ID, (array) $current_taxonomies );
235
+ if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
236
+ $term_taxonomy_ids = array_unique( wp_list_pluck( $terms, 'term_taxonomy_id' ) );
237
+
238
+ $tax_query[] = array(
239
+ 'taxonomy' => 'category',
240
+ 'field' => 'term_taxonomy_id',
241
+ 'terms' => wp_parse_id_list( $term_taxonomy_ids ),
242
+ 'operator' => 'IN',
243
+ 'include_children' => false,
244
+ );
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Filter the tax_query passed to the query.
250
+ *
251
+ * @since 3.0.0
252
+ *
253
+ * @param array $tax_query Array of tax_query parameters.
254
+ * @param WP_Post $source_post Source Post instance.
255
+ * @param array $args Arguments array.
256
+ */
257
+ $tax_query = apply_filters( 'crp_query_tax_query', $tax_query, $source_post, $args );
258
+
259
+ // Add a relation key if more than one $tax_query.
260
+ if ( count( $tax_query ) > 1 ) {
261
+ $tax_query['relation'] = 'AND';
262
+ }
263
+
264
+ $args['tax_query'] = $tax_query; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
265
+
266
+ /**
267
+ * Filter the post_types passed to the query.
268
+ *
269
+ * @since 2.2.0
270
+ * @since 3.0.0 Changed second argument from post ID to WP_Post object.
271
+ *
272
+ * @param array $post_types Array of post types to filter by.
273
+ * @param WP_Post $source_post Source Post instance.
274
+ * @param array $args Arguments array.
275
+ */
276
+ $args['post_type'] = apply_filters( 'crp_posts_post_types', $post_types, $source_post, $args );
277
+
278
+ // Set date_query.
279
+ $args['date_query'] = array(
280
+ array(
281
+ 'after' => gmdate( 'Y-m-d', strtotime( current_time( 'mysql' ) ) - ( absint( $args['daily_range'] ) * DAY_IN_SECONDS ) ),
282
+ 'before' => current_time( 'Y-m-d' ),
283
+ 'inclusive' => true,
284
+ ),
285
+ );
286
+
287
+ // Set post_status.
288
+ $args['post_status'] = empty( $args['post_status'] ) ? array( 'publish', 'inherit' ) : $args['post_status'];
289
+
290
+ // Set post__not_in for WP_Query using exclude_post_ids.
291
+ $exclude_post_ids = empty( $args['exclude_post_ids'] ) ? array() : wp_parse_id_list( $args['exclude_post_ids'] );
292
+
293
+ /**
294
+ * Filter exclude post IDs array.
295
+ *
296
+ * @since 2.3.0
297
+ * @since 2.9.3 Added $args
298
+ *
299
+ * @param array $exclude_post_ids Array of post IDs.
300
+ * @param array $args Arguments array.
301
+ */
302
+ $exclude_post_ids = apply_filters( 'crp_exclude_post_ids', $exclude_post_ids, $args );
303
+
304
+ $exclude_post_ids[] = $source_post->ID;
305
+ $args['post__not_in'] = $exclude_post_ids;
306
+
307
+ // Same author.
308
+ if ( isset( $args['same_author'] ) && $args['same_author'] ) {
309
+ $args['author'] = $source_post->post_author;
310
+ }
311
+
312
+ // Disable contextual matching.
313
+ if ( ! empty( $args['disable_contextual'] ) ) {
314
+ /* If post or page and we're not disabling custom post types */
315
+ if ( ( 'post' === $source_post->post_type || 'page' === $source_post->post_type ) && ( $args['disable_contextual_cpt'] ) ) {
316
+ $this->enable_relevance = true;
317
+ } else {
318
+ $this->enable_relevance = false;
319
+ }
320
+ }
321
+
322
+ // Unset what we don't need.
323
+ unset( $args['title'] );
324
+ unset( $args['blank_output'] );
325
+ unset( $args['blank_output_text'] );
326
+ unset( $args['show_excerpt'] );
327
+ unset( $args['excerpt_length'] );
328
+ unset( $args['show_date'] );
329
+ unset( $args['show_author'] );
330
+ unset( $args['title_length'] );
331
+ unset( $args['link_new_window'] );
332
+ unset( $args['link_nofollow'] );
333
+ unset( $args['before_list'] );
334
+ unset( $args['after_list'] );
335
+ unset( $args['before_list_item'] );
336
+ unset( $args['after_list_item'] );
337
+
338
+ /**
339
+ * Filters the arguments of the query.
340
+ *
341
+ * @since 3.0.0
342
+ *
343
+ * @param array $args The arguments of the query.
344
+ * @param CRP_Query $this The CRP_Query instance (passed by reference).
345
+ */
346
+ $this->query_args = apply_filters_ref_array( 'crp_query_args', array( $args, &$this ) );
347
+ }
348
+
349
+ /**
350
+ * Get the MATCH sql.
351
+ *
352
+ * @since 3.0.0
353
+ *
354
+ * @return string Updated Fields
355
+ */
356
+ public function get_match_sql() {
357
+ global $wpdb;
358
+
359
+ // Are we matching only the title or the post content as well?
360
+ $match_fields = array(
361
+ "$wpdb->posts.post_title",
362
+ );
363
+
364
+ $match_fields_content = array(
365
+ $this->source_post->post_title,
366
+ );
367
+
368
+ if ( $this->query_args['match_content'] ) {
369
+ $match_fields[] = "$wpdb->posts.post_content";
370
+ $match_fields_content[] = crp_excerpt( $this->source_post, min( $this->query_args['match_content_words'], CRP_MAX_WORDS ), false );
371
+ }
372
+
373
+ if ( isset( $this->crp_post_meta['keyword'] ) ) {
374
+ $match_fields_content = array(
375
+ $this->crp_post_meta['keyword'],
376
+ );
377
+ }
378
+
379
+ /**
380
+ * Filter the fields that are to be matched.
381
+ *
382
+ * @since 2.2.0
383
+ * @since 2.9.3 Added $args
384
+ * @since 3.0.0 Changed second argument from post ID to WP_Post object.
385
+ *
386
+ * @param array $match_fields Array of fields to be matched.
387
+ * @param WP_Post $source_post Source Post instance.
388
+ * @param array $query_args Arguments array.
389
+ */
390
+ $match_fields = apply_filters( 'crp_posts_match_fields', $match_fields, $this->source_post, $this->query_args );
391
+
392
+ /**
393
+ * Filter the content of the fields that are to be matched.
394
+ *
395
+ * @since 2.2.0
396
+ * @since 2.9.3 Added $args
397
+ * @since 3.0.0 Changed second argument from post ID to WP_Post object.
398
+ *
399
+ * @param array $match_fields_content Array of content of fields to be matched
400
+ * @param WP_Post $source_post Source Post instance.
401
+ * @param array $query_args Arguments array.
402
+ */
403
+ $match_fields_content = apply_filters( 'crp_posts_match_fields_content', $match_fields_content, $this->source_post, $this->query_args );
404
+
405
+ // Convert our arrays into their corresponding strings after they have been filtered.
406
+ $this->match_fields = implode( ',', $match_fields );
407
+ $this->stuff = implode( ' ', $match_fields_content );
408
+
409
+ // Create the base MATCH clause.
410
+ $match = $wpdb->prepare( ' MATCH (' . $this->match_fields . ') AGAINST (%s) ', $this->stuff ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
411
+
412
+ return $match;
413
+ }
414
+
415
+ /**
416
+ * Modify the SELECT clause - posts_fields.
417
+ *
418
+ * @since 3.0.0
419
+ *
420
+ * @param string $fields The SELECT clause of the query.
421
+ * @param WP_Query $query The WP_Query instance.
422
+ * @return string Updated Fields
423
+ */
424
+ public function posts_fields( $fields, $query ) {
425
+
426
+ // Return if it is not a CRP_Query.
427
+ if ( true !== $query->get( 'crp_query' ) ) {
428
+ return $fields;
429
+ }
430
+
431
+ if ( $this->enable_relevance ) {
432
+ $match = ', ' . $this->get_match_sql() . ' as score ';
433
+ $fields .= $match;
434
+ }
435
+
436
+ return $fields;
437
+ }
438
+
439
+ /**
440
+ * Modify the posts_join clause.
441
+ *
442
+ * @since 3.0.0
443
+ *
444
+ * @param string $join The JOIN clause of the query.
445
+ * @param WP_Query $query The WP_Query instance.
446
+ * @return string Updated JOIN
447
+ */
448
+ public function posts_join( $join, $query ) {
449
+ global $wpdb;
450
+
451
+ // Return if it is not a CRP_Query.
452
+ if ( true !== $query->get( 'crp_query' ) ) {
453
+ return $join;
454
+ }
455
+
456
+ if ( ! empty( $this->query_args['match_all'] ) || ( isset( $this->query_args['no_of_common_terms'] ) && absint( $this->query_args['no_of_common_terms'] ) > 1 ) ) {
457
+ $join .= " INNER JOIN $wpdb->term_relationships AS crp_tr ON ($wpdb->posts.ID = crp_tr.object_id) ";
458
+ $join .= " INNER JOIN $wpdb->term_taxonomy AS crp_tt ON (crp_tr.term_taxonomy_id = crp_tt.term_taxonomy_id) ";
459
+ }
460
+
461
+ return $join;
462
+ }
463
+
464
+ /**
465
+ * Modify the posts_where clause.
466
+ *
467
+ * @since 3.0.0
468
+ *
469
+ * @param string $where The WHERE clause of the query.
470
+ * @param WP_Query $query The WP_Query instance.
471
+ * @return string Updated WHERE
472
+ */
473
+ public function posts_where( $where, $query ) {
474
+
475
+ // Return if it is not a CRP_Query.
476
+ if ( true !== $query->get( 'crp_query' ) ) {
477
+ return $where;
478
+ }
479
+
480
+ if ( $this->enable_relevance ) {
481
+
482
+ $match = ' AND ' . $this->get_match_sql();
483
+
484
+ /**
485
+ * Filter the MATCH clause of the query.
486
+ *
487
+ * @since 2.1.0
488
+ * @since 2.9.0 Added $match_fields
489
+ * @since 2.9.3 Added $args
490
+ * @since 3.0.0 Changed third argument from post ID to WP_Post object.
491
+ *
492
+ * @param string $match The MATCH section of the WHERE clause of the query.
493
+ * @param string $stuff String to match fulltext with.
494
+ * @param WP_Post $source_post Source Post instance.
495
+ * @param string $match_fields Fields to match.
496
+ * @param array $args Arguments array.
497
+ */
498
+ $match = apply_filters( 'crp_posts_match', $match, $this->stuff, $this->source_post, $this->match_fields, $this->query_args );
499
+
500
+ $where .= $match;
501
+
502
+ }
503
+ return $where;
504
+ }
505
+
506
+ /**
507
+ * Modify the posts_orderby clause.
508
+ *
509
+ * @since 3.0.0
510
+ *
511
+ * @param string $orderby The ORDER BY clause of the query.
512
+ * @param WP_Query $query The WP_Query instance.
513
+ * @return string Updated ORDER BY
514
+ */
515
+ public function posts_orderby( $orderby, $query ) {
516
+ global $wpdb;
517
+
518
+ // Return if it is not a CRP_Query.
519
+ if ( true !== $query->get( 'crp_query' ) ) {
520
+ return $orderby;
521
+ }
522
+
523
+ // If orderby is set, then this was done intentionally and we don't make any modifications.
524
+ if ( ! empty( $query->get( 'orderby' ) ) ) {
525
+ return $orderby;
526
+ }
527
+
528
+ if ( $this->enable_relevance ) {
529
+ $orderby = ' score DESC ';
530
+ }
531
+
532
+ // Set order by in case of date.
533
+ if ( isset( $this->query_args['ordering'] ) && 'date' === $this->query_args['ordering'] ) {
534
+ $orderby = " $wpdb->posts.post_date DESC ";
535
+ }
536
+
537
+ return $orderby;
538
+ }
539
+
540
+ /**
541
+ * Modify the completed SQL query before sending.
542
+ *
543
+ * @since 3.0.0
544
+ *
545
+ * @param string $sql The complete SQL query.
546
+ * @param WP_Query $query The WP_Query instance.
547
+ * @return string Updated SQL query.
548
+ */
549
+ public function posts_request( $sql, $query ) {
550
+ global $wpdb;
551
+
552
+ $conditions = array();
553
+
554
+ // Return if it is not a CRP_Query.
555
+ if ( true !== $query->get( 'crp_query' ) ) {
556
+ return $sql;
557
+ }
558
+
559
+ if ( ! empty( $this->query_args['match_all'] ) && ! empty( $this->query_args['taxonomy_count'] ) ) {
560
+ $conditions[] = $wpdb->prepare( 'COUNT(DISTINCT crp_tt.taxonomy) = %d', $this->query_args['taxonomy_count'] );
561
+ }
562
+ if ( isset( $this->query_args['no_of_common_terms'] ) && absint( $this->query_args['no_of_common_terms'] ) > 1 ) {
563
+ $conditions[] = $wpdb->prepare( 'COUNT(DISTINCT crp_tt.term_id) >= %d', absint( $this->query_args['no_of_common_terms'] ) );
564
+ }
565
+
566
+ if ( ! empty( $conditions ) ) {
567
+ $conditions = implode( ' AND ', $conditions );
568
+ $having = "HAVING ( {$conditions} ) ORDER BY";
569
+
570
+ $sql = str_replace(
571
+ 'ORDER BY',
572
+ $having,
573
+ $sql
574
+ );
575
+
576
+ }
577
+
578
+ return $sql;
579
+ }
580
+
581
+ /**
582
+ * Filter posts_pre_query to allow caching to work.
583
+ *
584
+ * @since 3.0.0
585
+ *
586
+ * @param string $posts Array of post data.
587
+ * @param WP_Query $query The WP_Query instance.
588
+ * @return string Updated Array of post objects.
589
+ */
590
+ public function posts_pre_query( $posts, $query ) {
591
+
592
+ // Return if it is not a CRP_Query.
593
+ if ( true !== $query->get( 'crp_query' ) ) {
594
+ return $posts;
595
+ }
596
+
597
+ // Check the cache if there are any posts saved.
598
+ if ( ! empty( $this->query_args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
599
+
600
+ $meta_key = crp_cache_get_key( $this->request );
601
+
602
+ $post_ids = get_crp_cache( $this->source_post->ID, $meta_key );
603
+
604
+ if ( ! empty( $post_ids ) ) {
605
+ $posts = get_posts(
606
+ array(
607
+ 'post__in' => $post_ids,
608
+ 'fields' => $query->get( 'fields' ),
609
+ 'orderby' => 'post__in',
610
+ 'post_type' => $query->get( 'post_type' ),
611
+ )
612
+ );
613
+ $query->found_posts = count( $posts );
614
+ $query->max_num_pages = ceil( $query->found_posts / $query->get( 'posts_per_page' ) );
615
+ $this->in_cache = true;
616
+ }
617
+ }
618
+
619
+ return $posts;
620
+ }
621
+
622
+ /**
623
+ * Modify the array of retrieved posts.
624
+ *
625
+ * @since 3.0.0
626
+ *
627
+ * @param WP_Post[] $posts Array of post objects.
628
+ * @param WP_Query $query The WP_Query instance (passed by reference).
629
+ * @return string Updated Array of post objects.
630
+ */
631
+ public function the_posts( $posts, $query ) {
632
+
633
+ // Return if it is not a CRP_Query.
634
+ if ( true !== $query->get( 'crp_query' ) ) {
635
+ return $posts;
636
+ }
637
+
638
+ // Support caching to speed up retrieval.
639
+ if ( ! empty( $this->query_args['cache_posts'] ) && ! $this->in_cache && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
640
+ $meta_key = crp_cache_get_key( $this->request );
641
+ $post_ids = wp_list_pluck( $query->posts, 'ID' );
642
+
643
+ set_crp_cache( $this->source_post->ID, $meta_key, $post_ids );
644
+ }
645
+
646
+ // Manual Posts (manual_related - set via the Post Meta) or Include Posts (can be set as a parameter).
647
+ $post_ids = array();
648
+
649
+ if ( ! empty( $this->crp_post_meta['manual_related'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
650
+ $manual_related = wp_parse_id_list( $this->crp_post_meta['manual_related'] );
651
+ $post_ids = array_merge( $post_ids, $manual_related );
652
+ }
653
+ if ( ! empty( $this->query_args['include_post_ids'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
654
+ $include_post_ids = wp_parse_id_list( $this->query_args['include_post_ids'] );
655
+ $post_ids = array_merge( $post_ids, $include_post_ids );
656
+ }
657
+ if ( ! empty( $post_ids ) ) {
658
+ $extra_posts = get_posts(
659
+ array(
660
+ 'post__in' => $post_ids,
661
+ 'fields' => $query->get( 'fields' ),
662
+ 'orderby' => 'post__in',
663
+ 'post_type' => $query->get( 'post_type' ),
664
+ )
665
+ );
666
+ $posts = array_merge( $extra_posts, $posts );
667
+ }
668
+
669
+ // Shuffle posts if random order is set.
670
+ if ( $this->random_order ) {
671
+ shuffle( $posts );
672
+ }
673
+
674
+ /**
675
+ * Filter array of WP_Post objects before it is returned to the CRP_Query instance.
676
+ *
677
+ * @since 1.9
678
+ * @since 2.9.3 Added $args
679
+ *
680
+ * @param object $posts Array of post objects.
681
+ * @param array $args Arguments array.
682
+ */
683
+ return apply_filters( 'crp_query_the_posts', $posts, $this->query_args );
684
+ }
685
+ }
686
+ endif;
includes/content.php CHANGED
@@ -3,10 +3,6 @@
3
  * Functions related to the content
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
3
  * Functions related to the content
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
includes/deprecated.php CHANGED
@@ -22,42 +22,6 @@ if ( ! defined( 'WPINC' ) ) {
22
  */
23
  $crp_url = plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) );
24
 
25
- /**
26
- * Fetch related posts.
27
- *
28
- * @since 1.8.6
29
- *
30
- * @deprecated v2.0.0
31
- * @see get_crp_posts_id
32
- *
33
- * @param int $postid (default: FALSE) The post ID for which you want the posts for.
34
- * @param int $limit (default: FALSE) Maximum posts to retreive.
35
- * @param boolean $strict_limit (default: TRUE) Setting to true will fetch exactly as per limit above.
36
- * @return object Object with Post IDs
37
- */
38
- function get_crp_posts( $postid = false, $limit = false, $strict_limit = true ) {
39
-
40
- _deprecated_function( __FUNCTION__, '2.0.0', 'get_crp_posts_id()' );
41
-
42
- $results = get_crp_posts_id(
43
- array(
44
- 'postid' => $postid,
45
- 'limit' => $limit,
46
- 'strict_limit' => $strict_limit,
47
- )
48
- );
49
-
50
- /**
51
- * Filter object containing the post IDs.
52
- *
53
- * @since 1.9
54
- *
55
- * @param object $results Object containing the related post IDs
56
- */
57
- return apply_filters( 'get_crp_posts', $results );
58
- }
59
-
60
-
61
  /**
62
  * Main function to generate the related posts output
63
  *
22
  */
23
  $crp_url = plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) );
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  /**
26
  * Main function to generate the related posts output
27
  *
includes/header.php CHANGED
@@ -3,10 +3,6 @@
3
  * Functions related to the header
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -53,31 +49,81 @@ add_action( 'wp_head', 'crp_header' );
53
  */
54
  function crp_heading_styles() {
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  $thumb_width = crp_get_option( 'thumb_width' );
57
  $thumb_height = crp_get_option( 'thumb_height' );
 
58
 
59
- if ( 'rounded_thumbs' === crp_get_option( 'crp_styles' ) ) {
60
- wp_register_style( 'crp-style-rounded-thumbs', plugins_url( 'css/default-style.css', CRP_PLUGIN_FILE ), array(), '1.0' );
61
- wp_enqueue_style( 'crp-style-rounded-thumbs' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
- $custom_css = "
64
- .crp_related a {
65
- width: {$thumb_width}px;
66
- height: {$thumb_height}px;
67
- text-decoration: none;
68
- }
69
- .crp_related img {
70
- max-width: {$thumb_width}px;
71
- margin: auto;
72
- }
73
- .crp_related .crp_title {
74
- width: 100%;
75
- }
76
- ";
77
 
78
- wp_add_inline_style( 'crp-style-rounded-thumbs', $custom_css );
 
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
- }
82
- add_action( 'wp_enqueue_scripts', 'crp_heading_styles' );
83
 
 
 
3
  * Functions related to the header
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
49
  */
50
  function crp_heading_styles() {
51
 
52
+ $style_array = crp_get_style();
53
+
54
+ if ( ! empty( $style_array ) ) {
55
+ $style = $style_array['name'];
56
+ $extra_css = $style_array['extra_css'];
57
+
58
+ wp_register_style( "crp-style-{$style}", plugins_url( "css/{$style}.min.css", CRP_PLUGIN_FILE ), array(), '1.0' );
59
+ wp_enqueue_style( "crp-style-{$style}" );
60
+ wp_add_inline_style( "crp-style-{$style}", $extra_css );
61
+ }
62
+ }
63
+ add_action( 'wp_enqueue_scripts', 'crp_heading_styles' );
64
+
65
+
66
+ /**
67
+ * Get the current style for the related posts.
68
+ *
69
+ * @return array Contains two elements:
70
+ * 'name' holding style name and 'extra_css' to be added inline.
71
+ */
72
+ function crp_get_style() {
73
+
74
+ $style = array();
75
  $thumb_width = crp_get_option( 'thumb_width' );
76
  $thumb_height = crp_get_option( 'thumb_height' );
77
+ $crp_style = crp_get_option( 'crp_styles' );
78
 
79
+ switch ( $crp_style ) {
80
+ case 'rounded_thumbs':
81
+ $style['name'] = 'rounded-thumbs';
82
+ $style['extra_css'] = "
83
+ .crp_related a {
84
+ width: {$thumb_width}px;
85
+ height: {$thumb_height}px;
86
+ text-decoration: none;
87
+ }
88
+ .crp_related img {
89
+ max-width: {$thumb_width}px;
90
+ margin: auto;
91
+ }
92
+ .crp_related .crp_title {
93
+ width: 100%;
94
+ }
95
+ ";
96
+ break;
97
 
98
+ case 'masonry':
99
+ $style['name'] = 'masonry';
100
+ $style['extra_css'] = '';
101
+ break;
102
+
103
+ case 'grid':
104
+ $style['name'] = 'grid';
105
+ $style['extra_css'] = '';
106
+ break;
 
 
 
 
 
107
 
108
+ case 'thumbs_grid':
109
+ $row_height = max( 0, $thumb_height - 50 );
110
 
111
+ $style['name'] = 'thumbs-grid';
112
+ $style['extra_css'] = "
113
+ .crp_related ul li a.crp_link {
114
+ grid-template-rows: {$row_height}px 50px;
115
+ }
116
+ .crp_related ul {
117
+ grid-template-columns: repeat(auto-fill, minmax({$thumb_width}px, 1fr));
118
+ }
119
+ ";
120
+ break;
121
+
122
+ default:
123
+ $style['name'] = '';
124
+ $style['extra_css'] = '';
125
+ break;
126
  }
 
 
127
 
128
+ return $style;
129
+ }
includes/i10n.php CHANGED
@@ -20,46 +20,86 @@ function crp_lang_init() {
20
  }
21
  add_action( 'plugins_loaded', 'crp_lang_init' );
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  /**
25
  * Returns the object identifier for the current language (WPML).
26
  *
27
- * @since 2.1.0
 
28
  *
29
- * @param int|string $post_id Post ID.
 
30
  */
31
- function crp_object_id_cur_lang( $post_id ) {
32
 
33
  $return_original_if_missing = false;
34
 
35
- $post = get_post( $post_id );
36
  $current_lang = apply_filters( 'wpml_current_language', null );
37
 
38
- /**
39
- * Filter to modify if the original language ID is returned.
40
- *
41
- * @since 2.2.3
42
- *
43
- * @param bool $return_original_if_missing
44
- * @param int $post_id Post ID
45
- */
46
- $return_original_if_missing = apply_filters( 'crp_wpml_return_original', $return_original_if_missing, $post_id );
47
-
48
  // Polylang implementation.
49
  if ( function_exists( 'pll_get_post' ) ) {
50
- $post_id = pll_get_post( $post_id );
 
51
  }
52
 
53
  // WPML implementation.
54
- $post_id = apply_filters( 'wpml_object_id', $post_id, $post->post_type, $return_original_if_missing, $current_lang );
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  /**
57
  * Filters object ID for current language (WPML).
58
  *
59
  * @since 2.1.0
60
  *
61
- * @param int $post_id Post ID
62
  */
63
- return apply_filters( 'crp_object_id_cur_lang', $post_id );
64
  }
65
 
20
  }
21
  add_action( 'plugins_loaded', 'crp_lang_init' );
22
 
23
+ /**
24
+ * Get the ID of a post in the current language. Works with WPML and PolyLang.
25
+ *
26
+ * @since 3.0.0
27
+ *
28
+ * @param array $results Arry of Posts.
29
+ * @return array Updated array of WP_Post objects.
30
+ */
31
+ function crp_translate_ids( $results ) {
32
+ global $post;
33
+
34
+ $processed_ids = array();
35
+ $processed_results = array();
36
+
37
+ foreach ( $results as $result ) {
38
+
39
+ $result = crp_object_id_cur_lang( $result );
40
+
41
+ // If this is NULL or already processed ID or matches current post then skip processing this loop.
42
+ if ( ! $result->ID || in_array( $result->ID, $processed_ids ) || intval( $result->ID ) === intval( $post->ID ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
43
+ continue;
44
+ }
45
+
46
+ // Push the current ID into the array to ensure we're not repeating it.
47
+ array_push( $processed_ids, $result->ID );
48
+
49
+ $result = get_post( $result ); // Let's get the Post using the ID.
50
+ array_push( $processed_results, $result );
51
+ }
52
+ return $processed_results;
53
+ }
54
+ add_filter( 'get_crp_posts_id', 'crp_translate_ids', 999 );
55
+ add_filter( 'crp_query_the_posts', 'crp_translate_ids', 999 );
56
+
57
 
58
  /**
59
  * Returns the object identifier for the current language (WPML).
60
  *
61
+ * @since 2.1.0
62
+ * @since 3.0.0 Parameter can be a WP_Post object. Return is a WP_Post object.
63
  *
64
+ * @param WP_Post|int|string $post Post object or Post ID.
65
+ * @return WP_Post Post opbject, updated if needed.
66
  */
67
+ function crp_object_id_cur_lang( $post ) {
68
 
69
  $return_original_if_missing = false;
70
 
71
+ $post = get_post( $post );
72
  $current_lang = apply_filters( 'wpml_current_language', null );
73
 
 
 
 
 
 
 
 
 
 
 
74
  // Polylang implementation.
75
  if ( function_exists( 'pll_get_post' ) ) {
76
+ $post = pll_get_post( $post->ID );
77
+ $post = get_post( $post );
78
  }
79
 
80
  // WPML implementation.
81
+ if ( class_exists( 'SitePress' ) ) {
82
+ /**
83
+ * Filter to modify if the original language ID is returned.
84
+ *
85
+ * @since 2.2.3
86
+ *
87
+ * @param bool $return_original_if_missing
88
+ * @param int $post->ID Post ID
89
+ */
90
+ $return_original_if_missing = apply_filters( 'crp_wpml_return_original', $return_original_if_missing, $post->ID );
91
+
92
+ $post = apply_filters( 'wpml_object_id', $post->ID, $post->post_type, $return_original_if_missing, $current_lang );
93
+ $post = get_post( $post );
94
+ }
95
 
96
  /**
97
  * Filters object ID for current language (WPML).
98
  *
99
  * @since 2.1.0
100
  *
101
+ * @param int $post->ID Post ID
102
  */
103
+ return apply_filters( 'crp_object_id_cur_lang', $post );
104
  }
105
 
includes/main-query.php CHANGED
@@ -3,10 +3,6 @@
3
  * Functions related to the header
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -31,14 +27,15 @@ function get_crp( $args = array() ) {
31
  $args['strict_limit'] = false;
32
  }
33
  $defaults = array(
34
- 'is_widget' => false,
35
- 'is_shortcode' => false,
36
- 'is_manual' => false,
37
- 'is_block' => false,
38
- 'echo' => true,
39
- 'heading' => true,
40
- 'offset' => 0,
41
- 'extra_class' => '',
 
42
  );
43
  $defaults = array_merge( $defaults, $crp_settings );
44
 
@@ -63,27 +60,15 @@ function get_crp( $args = array() ) {
63
  return false;
64
  }
65
 
66
- // WPML support.
67
- if ( function_exists( 'wpml_object_id_filter' ) || function_exists( 'icl_object_id' ) ) {
68
  $args['strict_limit'] = false;
69
  }
70
 
71
  // Support caching to speed up retrieval.
72
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
73
- $meta_key = 'crp_related_posts';
74
- if ( $args['is_widget'] ) {
75
- $meta_key .= '_widget';
76
- }
77
- if ( $args['is_manual'] ) {
78
- $meta_key .= '_manual';
79
- }
80
- if ( $args['is_block'] ) {
81
- $meta_key .= '_block';
82
- }
83
- if ( is_feed() ) {
84
- $meta_key .= '_feed';
85
- }
86
- $output = get_post_meta( $post->ID, $meta_key, true );
87
  if ( $output ) {
88
  return $output;
89
  }
@@ -93,7 +78,7 @@ function get_crp( $args = array() ) {
93
  list( $args['thumb_width'], $args['thumb_height'] ) = crp_get_thumb_size( $args );
94
 
95
  // Retrieve the list of posts.
96
- $results = get_crp_posts_id(
97
  array_merge(
98
  $args,
99
  array(
@@ -116,7 +101,7 @@ function get_crp( $args = array() ) {
116
  $custom_template = apply_filters( 'crp_custom_template', null, $results, $args );
117
  if ( ! empty( $custom_template ) ) {
118
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
119
- update_post_meta( $post->ID, $meta_key, $custom_template, '' );
120
  }
121
  return $custom_template;
122
  }
@@ -147,34 +132,9 @@ function get_crp( $args = array() ) {
147
 
148
  $output .= crp_before_list( $args );
149
 
150
- // We need this for WPML support.
151
- $processed_results = array();
152
-
153
  foreach ( $results as $result ) {
154
 
155
- /* Support WPML */
156
- $resultid = crp_object_id_cur_lang( $result->ID );
157
-
158
- // If this is NULL or already processed ID or matches current post then skip processing this loop.
159
- if ( ! $resultid || in_array( $resultid, $processed_results ) || intval( $resultid ) === intval( $post->ID ) ) { // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
160
- continue;
161
- }
162
-
163
- // Push the current ID into the array to ensure we're not repeating it.
164
- array_push( $processed_results, $resultid );
165
-
166
- /**
167
- * Filter the post ID for each result. Allows a custom function to hook in and change the ID if needed.
168
- *
169
- * @since 1.9
170
- * @since 2.9.3 Added $args
171
- *
172
- * @param int $resultid ID of the post
173
- * @param array $args Arguments array.
174
- */
175
- $resultid = apply_filters( 'crp_post_id', $resultid, $args );
176
-
177
- $result = get_post( $resultid ); // Let's get the Post using the ID.
178
 
179
  // Process the category exclusion if passed in the shortcode.
180
  if ( isset( $exclude_categories ) ) {
@@ -206,7 +166,7 @@ function get_crp( $args = array() ) {
206
  }
207
 
208
  if ( $args['show_excerpt'] ) {
209
- $output .= '<span class="crp_excerpt"> ' . crp_excerpt( $result->ID, $args['excerpt_length'] ) . '</span>';
210
  }
211
 
212
  $loop_counter++;
@@ -249,7 +209,7 @@ function get_crp( $args = array() ) {
249
  }
250
 
251
  // Check if the opening list tag is missing in the output, it means all of our results were eliminated cause of the category filter.
252
- if ( false === ( strpos( $output, $args['before_list_item'] ) ) ) {
253
  $output = '<div id="crp_related">';
254
  $output .= ( $args['blank_output'] ) ? ' ' : '<p>' . $args['blank_output_text'] . '</p>';
255
  }
@@ -258,7 +218,7 @@ function get_crp( $args = array() ) {
258
 
259
  // Support caching to speed up retrieval.
260
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
261
- update_post_meta( $post->ID, $meta_key, $output, '' );
262
  }
263
 
264
  /**
@@ -357,16 +317,8 @@ function get_crp_posts_id( $args = array() ) {
357
  $post_types = (array) $source_post->post_type;
358
  }
359
 
360
- /**
361
- * Filter the post_type clause of the query.
362
- *
363
- * @since 2.2.0
364
- *
365
- * @param array $post_types Array of post types to filter by.
366
- * @param int $source_post->ID Post ID.
367
- * @param array $args Arguments array.
368
- */
369
- $post_types = apply_filters( 'crp_posts_post_types', $post_types, $source_post->ID, $args );
370
 
371
  // Are we matching only the title or the post content as well?
372
  $match_fields = array(
@@ -383,7 +335,7 @@ function get_crp_posts_id( $args = array() ) {
383
  }
384
 
385
  // If keyword is entered, override the matching content.
386
- $crp_post_meta = get_post_meta( $post->ID, 'crp_post_meta', true );
387
 
388
  if ( isset( $crp_post_meta['keyword'] ) ) {
389
  $match_fields_content = array(
@@ -391,29 +343,11 @@ function get_crp_posts_id( $args = array() ) {
391
  );
392
  }
393
 
394
- /**
395
- * Filter the fields that are to be matched.
396
- *
397
- * @since 2.2.0
398
- * @since 2.9.3 Added $args
399
- *
400
- * @param array $match_fields Array of fields to be matched
401
- * @param int $source_post->ID Post ID
402
- * @param array $args Arguments array.
403
- */
404
- $match_fields = apply_filters( 'crp_posts_match_fields', $match_fields, $source_post->ID, $args );
405
 
406
- /**
407
- * Filter the content of the fields that are to be matched.
408
- *
409
- * @since 2.2.0
410
- * @since 2.9.3 Added $args
411
- *
412
- * @param array $match_fields_content Array of content of fields to be matched
413
- * @param int $source_post->ID Post ID
414
- * @param array $args Arguments array.
415
- */
416
- $match_fields_content = apply_filters( 'crp_posts_match_fields_content', $match_fields_content, $source_post->ID, $args );
417
 
418
  // Convert our arrays into their corresponding strings after they have been filtered.
419
  $match_fields = implode( ',', $match_fields );
@@ -442,20 +376,8 @@ function get_crp_posts_id( $args = array() ) {
442
  // Create the base MATCH clause.
443
  $match = $wpdb->prepare( ' AND MATCH (' . $match_fields . ') AGAINST (%s) ', $stuff ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
444
 
445
- /**
446
- * Filter the MATCH clause of the query.
447
- *
448
- * @since 2.1.0
449
- * @since 2.9.0 Added $match_fields
450
- * @since 2.9.3 Added $args
451
- *
452
- * @param string $match The MATCH section of the WHERE clause of the query.
453
- * @param string $stuff String to match fulltext with.
454
- * @param int $source_post->ID Post ID.
455
- * @param string $match_fields Fields to match.
456
- * @param array $args Arguments array.
457
- */
458
- $match = apply_filters( 'crp_posts_match', $match, $stuff, $source_post->ID, $match_fields, $args );
459
 
460
  // Create the maximum date limit. Show posts before today.
461
  $now_clause = $wpdb->prepare( " AND $wpdb->posts.post_date < %s ", $now );
@@ -501,15 +423,7 @@ function get_crp_posts_id( $args = array() ) {
501
  // Convert exclude post IDs string to array so it can be filtered.
502
  $exclude_post_ids = explode( ',', $args['exclude_post_ids'] );
503
 
504
- /**
505
- * Filter exclude post IDs array.
506
- *
507
- * @since 2.3.0
508
- * @since 2.9.3 Added $args
509
- *
510
- * @param array $exclude_post_ids Array of post IDs.
511
- * @param array $args Arguments array.
512
- */
513
  $exclude_post_ids = apply_filters( 'crp_exclude_post_ids', $exclude_post_ids, $args );
514
 
515
  // Convert it back to string.
@@ -657,19 +571,8 @@ function get_crp_posts_id( $args = array() ) {
657
  // Support caching to speed up retrieval.
658
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
659
 
660
- $attr = array(
661
- 'offset' => $offset,
662
- 'limit' => $limit,
663
- 'same_author' => isset( $args['same_author'] ) && $args['same_author'],
664
- 'exclude_post_ids' => $exclude_post_ids,
665
- 'post_types' => join( "', '", $post_types ),
666
- 'order_by' => $orderby,
667
- 'is_ssl' => is_ssl(),
668
- );
669
-
670
- $meta_key = crp_cache_get_key( $attr );
671
-
672
- $results = get_post_meta( $post->ID, $meta_key, true );
673
  }
674
 
675
  if ( empty( $results ) ) {
@@ -678,7 +581,7 @@ function get_crp_posts_id( $args = array() ) {
678
 
679
  // Support caching to speed up retrieval.
680
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
681
- update_post_meta( $post->ID, $meta_key, $results, '' );
682
  }
683
 
684
  if ( $random_order ) {
@@ -704,16 +607,35 @@ function get_crp_posts_id( $args = array() ) {
704
 
705
 
706
  /**
707
- * Get the meta key based on a list of parameters.
 
 
708
  *
709
- * @since 2.7.0
 
710
  *
711
- * @param array $attr Array of attributes.
712
- * @return string Cache meta key
 
 
713
  */
714
- function crp_cache_get_key( $attr ) {
 
 
 
 
 
 
715
 
716
- $meta_key = '_crp_cache_' . md5( wp_json_encode( $attr ) );
717
 
718
- return $meta_key;
 
 
 
 
 
 
 
 
719
  }
3
  * Functions related to the header
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
27
  $args['strict_limit'] = false;
28
  }
29
  $defaults = array(
30
+ 'is_widget' => false,
31
+ 'is_shortcode' => false,
32
+ 'is_manual' => false,
33
+ 'is_block' => false,
34
+ 'echo' => true,
35
+ 'heading' => true,
36
+ 'offset' => 0,
37
+ 'extra_class' => '',
38
+ 'more_link_text' => '',
39
  );
40
  $defaults = array_merge( $defaults, $crp_settings );
41
 
60
  return false;
61
  }
62
 
63
+ // WPML & PolyLang support - change strict limit to false.
64
+ if ( class_exists( 'SitePress' ) || function_exists( 'pll_get_post' ) ) {
65
  $args['strict_limit'] = false;
66
  }
67
 
68
  // Support caching to speed up retrieval.
69
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
70
+ $meta_key = crp_cache_get_key( $args );
71
+ $output = get_crp_cache( $post->ID, $meta_key );
 
 
 
 
 
 
 
 
 
 
 
 
72
  if ( $output ) {
73
  return $output;
74
  }
78
  list( $args['thumb_width'], $args['thumb_height'] ) = crp_get_thumb_size( $args );
79
 
80
  // Retrieve the list of posts.
81
+ $results = get_crp_posts(
82
  array_merge(
83
  $args,
84
  array(
101
  $custom_template = apply_filters( 'crp_custom_template', null, $results, $args );
102
  if ( ! empty( $custom_template ) ) {
103
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
104
+ set_crp_cache( $post->ID, $meta_key, $custom_template );
105
  }
106
  return $custom_template;
107
  }
132
 
133
  $output .= crp_before_list( $args );
134
 
 
 
 
135
  foreach ( $results as $result ) {
136
 
137
+ $result = get_post( $result->ID ); // Let's get the Post using the ID.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  // Process the category exclusion if passed in the shortcode.
140
  if ( isset( $exclude_categories ) ) {
166
  }
167
 
168
  if ( $args['show_excerpt'] ) {
169
+ $output .= '<span class="crp_excerpt"> ' . crp_excerpt( $result->ID, $args['excerpt_length'], true, $args['more_link_text'] ) . '</span>';
170
  }
171
 
172
  $loop_counter++;
209
  }
210
 
211
  // Check if the opening list tag is missing in the output, it means all of our results were eliminated cause of the category filter.
212
+ if ( ! empty( $args['before_list_item'] ) && false === strpos( $output, $args['before_list_item'] ) ) {
213
  $output = '<div id="crp_related">';
214
  $output .= ( $args['blank_output'] ) ? ' ' : '<p>' . $args['blank_output_text'] . '</p>';
215
  }
218
 
219
  // Support caching to speed up retrieval.
220
  if ( ! empty( $args['cache'] ) && empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
221
+ set_crp_cache( $post->ID, $meta_key, $output );
222
  }
223
 
224
  /**
317
  $post_types = (array) $source_post->post_type;
318
  }
319
 
320
+ /** This filter has been documented in class-crp-query.php */
321
+ $post_types = apply_filters( 'crp_posts_post_types', $post_types, $source_post, $args );
 
 
 
 
 
 
 
 
322
 
323
  // Are we matching only the title or the post content as well?
324
  $match_fields = array(
335
  }
336
 
337
  // If keyword is entered, override the matching content.
338
+ $crp_post_meta = get_post_meta( $source_post->ID, 'crp_post_meta', true );
339
 
340
  if ( isset( $crp_post_meta['keyword'] ) ) {
341
  $match_fields_content = array(
343
  );
344
  }
345
 
346
+ /** This filter has been documented in class-crp-query.php */
347
+ $match_fields = apply_filters( 'crp_posts_match_fields', $match_fields, $source_post, $args );
 
 
 
 
 
 
 
 
 
348
 
349
+ /** This filter has been documented in class-crp-query.php */
350
+ $match_fields_content = apply_filters( 'crp_posts_match_fields_content', $match_fields_content, $source_post, $args );
 
 
 
 
 
 
 
 
 
351
 
352
  // Convert our arrays into their corresponding strings after they have been filtered.
353
  $match_fields = implode( ',', $match_fields );
376
  // Create the base MATCH clause.
377
  $match = $wpdb->prepare( ' AND MATCH (' . $match_fields . ') AGAINST (%s) ', $stuff ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
378
 
379
+ /** This filter has been documented in class-crp-query.php */
380
+ $match = apply_filters( 'crp_posts_match', $match, $stuff, $source_post, $match_fields, $args );
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  // Create the maximum date limit. Show posts before today.
383
  $now_clause = $wpdb->prepare( " AND $wpdb->posts.post_date < %s ", $now );
423
  // Convert exclude post IDs string to array so it can be filtered.
424
  $exclude_post_ids = explode( ',', $args['exclude_post_ids'] );
425
 
426
+ /** This filter has been documented in class-crp-query.php */
 
 
 
 
 
 
 
 
427
  $exclude_post_ids = apply_filters( 'crp_exclude_post_ids', $exclude_post_ids, $args );
428
 
429
  // Convert it back to string.
571
  // Support caching to speed up retrieval.
572
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
573
 
574
+ $meta_key = crp_cache_get_key( $args );
575
+ $results = get_crp_cache( $post->ID, $meta_key );
 
 
 
 
 
 
 
 
 
 
 
576
  }
577
 
578
  if ( empty( $results ) ) {
581
 
582
  // Support caching to speed up retrieval.
583
  if ( ! empty( $args['cache_posts'] ) && ! ( is_preview() || is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
584
+ set_crp_cache( $post->ID, $meta_key, $results );
585
  }
586
 
587
  if ( $random_order ) {
607
 
608
 
609
  /**
610
+ * Retrieves an array of the related posts.
611
+ *
612
+ * The defaults are as follows:
613
  *
614
+ * @since 1.8.6
615
+ * @since 3.0.0 Parameters have been dropped for a single $args parameter.
616
  *
617
+ * @see CRP_Query::prepare_query_args()
618
+ *
619
+ * @param array $args Optional. Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments.
620
+ * @return WP_Post[]|int[] Array of post objects or post IDs.
621
  */
622
+ function get_crp_posts( $args = array() ) {
623
+ // Backcompat if postid was passed in the pre-3.0.0 version.
624
+ if ( is_int( $args ) ) {
625
+ $args = array(
626
+ 'postid' => $args,
627
+ );
628
+ }
629
 
630
+ $get_crp_posts = new CRP_Query( $args );
631
 
632
+ /**
633
+ * Filter array of post IDs or objects.
634
+ *
635
+ * @since 1.9
636
+ *
637
+ * @param WP_Post[]|int[] $posts Array of post objects or post IDs.
638
+ * @param array $args Arguments to retrieve posts.
639
+ */
640
+ return apply_filters( 'get_crp_posts', $get_crp_posts->posts, $args );
641
  }
includes/media.php CHANGED
@@ -3,10 +3,6 @@
3
  * Image handling functions
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -96,11 +92,11 @@ function crp_get_the_post_thumbnail( $args = array() ) {
96
  if ( $postimage ) {
97
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
98
 
99
- if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
100
- $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
101
  $postimage = $postthumb[0];
 
102
  }
103
- $pick .= 'correct';
104
  }
105
  }
106
 
@@ -141,8 +137,8 @@ function crp_get_the_post_thumbnail( $args = array() ) {
141
  if ( $postimage ) {
142
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
143
 
144
- if ( false !== wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) ) ) {
145
- $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
146
  $postimage = $postthumb[0];
147
  $pick .= 'correct';
148
  }
@@ -244,6 +240,14 @@ function crp_get_the_post_thumbnail( $args = array() ) {
244
  $attr['thumb_height'] = $args['thumb_height'];
245
 
246
  $output .= crp_get_image_html( $postimage, $attr );
 
 
 
 
 
 
 
 
247
  }
248
 
249
  /**
@@ -317,7 +321,7 @@ function crp_get_image_html( $attachment_url, $attr = array() ) {
317
 
318
  // If there is no url, return.
319
  if ( '' == $attachment_url ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
320
- return;
321
  }
322
 
323
  $default_attr = array(
@@ -373,7 +377,16 @@ function crp_get_image_html( $attachment_url, $attr = array() ) {
373
  }
374
  $html .= ' />';
375
 
376
- return apply_filters( 'crp_get_image_html', $html );
 
 
 
 
 
 
 
 
 
377
  }
378
 
379
 
3
  * Image handling functions
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
92
  if ( $postimage ) {
93
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
94
 
95
+ $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
96
+ if ( false !== $postthumb ) {
97
  $postimage = $postthumb[0];
98
+ $pick .= 'correct';
99
  }
 
100
  }
101
  }
102
 
137
  if ( $postimage ) {
138
  $postimage_id = crp_get_attachment_id_from_url( $postimage );
139
 
140
+ $postthumb = wp_get_attachment_image_src( $postimage_id, array( $args['thumb_width'], $args['thumb_height'] ) );
141
+ if ( false !== $postthumb ) {
142
  $postimage = $postthumb[0];
143
  $pick .= 'correct';
144
  }
240
  $attr['thumb_height'] = $args['thumb_height'];
241
 
242
  $output .= crp_get_image_html( $postimage, $attr );
243
+
244
+ if ( function_exists( 'wp_img_tag_add_srcset_and_sizes_attr' ) ) {
245
+ $output = wp_img_tag_add_srcset_and_sizes_attr( $output, 'crp_thumbnail', $attachment_id );
246
+ }
247
+
248
+ if ( function_exists( 'wp_img_tag_add_loading_attr' ) ) {
249
+ $output = wp_img_tag_add_loading_attr( $output, 'crp_thumbnail' );
250
+ }
251
  }
252
 
253
  /**
321
 
322
  // If there is no url, return.
323
  if ( '' == $attachment_url ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
324
+ return '';
325
  }
326
 
327
  $default_attr = array(
377
  }
378
  $html .= ' />';
379
 
380
+ /**
381
+ * Filters the img tag.
382
+ *
383
+ * @since 2.7.0
384
+ *
385
+ * @param string $html HTML img element or empty string on failure.
386
+ * @param string $attachment_url Image URL.
387
+ * @param array $attr Attributes for the image markup.
388
+ */
389
+ return apply_filters( 'crp_get_image_html', $html, $attachment_url, $attr );
390
  }
391
 
392
 
includes/modules/cache.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Contextual Related Posts Cache interface.
4
+ *
5
+ * @package Contextual_Related_Posts
6
+ */
7
+
8
+ // If this file is called directly, abort.
9
+ if ( ! defined( 'WPINC' ) ) {
10
+ die;
11
+ }
12
+
13
+ /**
14
+ * Function to clear the CRP Cache with Ajax.
15
+ *
16
+ * @since 1.8.10
17
+ */
18
+ function crp_ajax_clearcache() {
19
+
20
+ $count = crp_cache_delete();
21
+ exit(
22
+ wp_json_encode(
23
+ array(
24
+ 'success' => 1,
25
+ /* translators: 1: Number of entries. */
26
+ 'message' => sprintf( _n( '%s entry cleared', '%s entries cleared', $count, 'contextual-related-posts' ), number_format_i18n( $count ) ),
27
+ )
28
+ )
29
+ );
30
+ }
31
+ add_action( 'wp_ajax_crp_clear_cache', 'crp_ajax_clearcache' );
32
+
33
+
34
+ /**
35
+ * Delete the entire CRP cache.
36
+ *
37
+ * @since 2.2.0
38
+ *
39
+ * @param array $meta_keys Array of meta keys that hold the cache.
40
+ * @return int Number of keys deleted.
41
+ */
42
+ function crp_cache_delete( $meta_keys = array() ) {
43
+ $loop = 0;
44
+
45
+ $default_meta_keys = crp_cache_get_meta_keys();
46
+
47
+ if ( ! empty( $meta_keys ) ) {
48
+ $meta_keys = array_intersect( $default_meta_keys, (array) $meta_keys );
49
+ } else {
50
+ $meta_keys = $default_meta_keys;
51
+ }
52
+
53
+ foreach ( $meta_keys as $meta_key ) {
54
+ $del_meta = delete_post_meta_by_key( $meta_key );
55
+ if ( $del_meta ) {
56
+ $loop++;
57
+ }
58
+ }
59
+
60
+ return $loop;
61
+ }
62
+
63
+
64
+ /**
65
+ * Get array of cache keys.
66
+ *
67
+ * @since 2.2.0
68
+ *
69
+ * @return array $keys Array of cache keys.
70
+ */
71
+ function crp_cache_get_keys() {
72
+
73
+ $keys = crp_cache_get_meta_keys();
74
+
75
+ /**
76
+ * Filters the array containing the various cache keys.
77
+ *
78
+ * @since 2.2.0
79
+ *
80
+ * @param array $keys Array of cache keys.
81
+ */
82
+ return apply_filters( 'crp_cache_keys', $keys );
83
+ }
84
+
85
+
86
+ /**
87
+ * Get the _crp_cache keys.
88
+ *
89
+ * @since 2.7.0
90
+ *
91
+ * @return array Array of _crp_cache keys.
92
+ */
93
+ function crp_cache_get_meta_keys() {
94
+ global $wpdb;
95
+
96
+ $meta_keys = array(
97
+ 'crp_related_posts',
98
+ 'crp_related_posts_widget',
99
+ 'crp_related_posts_feed',
100
+ 'crp_related_posts_widget_feed',
101
+ 'crp_related_posts_manual',
102
+ 'crp_related_posts_block',
103
+ );
104
+
105
+ $keys = array();
106
+
107
+ $sql = "
108
+ SELECT meta_key
109
+ FROM {$wpdb->postmeta}
110
+ WHERE `meta_key` LIKE '_crp_cache_%'
111
+ ";
112
+
113
+ $results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
114
+
115
+ $keys = wp_list_pluck( $results, 'meta_key' );
116
+
117
+ $meta_keys = array_merge( $meta_keys, $keys );
118
+
119
+ /**
120
+ * Filter the array of CRP cache meta keys.
121
+ *
122
+ * @since 2.7.0
123
+ *
124
+ * @param array $meta_keys Array of CRP cache meta keys.
125
+ */
126
+ return apply_filters( 'crp_cache_get_meta_keys', $meta_keys );
127
+ }
128
+
129
+
130
+ /**
131
+ * Function to clear cache on post save.
132
+ *
133
+ * @since 2.5.0
134
+ *
135
+ * @param mixed $post_id Post ID.
136
+ */
137
+ function crp_delete_cache_post_save( $post_id ) {
138
+
139
+ // Bail if we're doing an auto save.
140
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
141
+ return;
142
+ }
143
+
144
+ // If our nonce isn't there, or we can't verify it, bail.
145
+ if ( ! isset( $_POST['crp_meta_box_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['crp_meta_box_nonce'] ), 'crp_meta_box' ) ) {
146
+ return;
147
+ }
148
+
149
+ // If our current user can't edit this post, bail.
150
+ if ( ! current_user_can( 'edit_post', $post_id ) ) {
151
+ return;
152
+ }
153
+
154
+ // Clear cache of current post.
155
+ $meta_keys = crp_cache_get_meta_keys();
156
+ foreach ( $meta_keys as $meta_key ) {
157
+ delete_post_meta( $post_id, $meta_key );
158
+ }
159
+
160
+ }
161
+ add_action( 'crp_save_meta_box', 'crp_delete_cache_post_save' );
162
+
163
+
164
+ /**
165
+ * Get the meta key based on a list of parameters.
166
+ *
167
+ * @since 2.7.0
168
+ *
169
+ * @param mixed $attr Array of attributes typically.
170
+ * @return string Cache meta key
171
+ */
172
+ function crp_cache_get_key( $attr ) {
173
+
174
+ $meta_key = md5( wp_json_encode( $attr ) );
175
+
176
+ return $meta_key;
177
+ }
178
+
179
+
180
+ /**
181
+ * Sets/updates the value of the CRP cache for a post.
182
+ *
183
+ * @since 3.0.0
184
+ *
185
+ * @param int $post_id Post ID.
186
+ * @param string $key CRP Cache key.
187
+ * @param mixed $value Metadata value. Must be serializable if non-scalar.
188
+ * @param int $expiration Time until expiration in seconds. Default CRP_CACHE_TIME (one month if not overridden).
189
+ * @return int|bool Meta ID if the key didn't exist, true on successful update,
190
+ * false on failure or if the value passed to the function
191
+ * is the same as the one that is already in the database.
192
+ */
193
+ function set_crp_cache( $post_id, $key, $value, $expiration = CRP_CACHE_TIME ) {
194
+
195
+ $expiration = (int) $expiration;
196
+
197
+ /**
198
+ * Filters the expiration for a CRP Cache key before its value is set.
199
+ *
200
+ * The dynamic portion of the hook name, `$key`, refers to the CRP Cache key.
201
+ *
202
+ * @since 3.0.0
203
+ *
204
+ * @param int $expiration Time until expiration in seconds. Use 0 for no expiration.
205
+ * @param int $post_id Post ID.
206
+ * @param string $key CRP Cache key name.
207
+ * @param mixed $value New value of CRP Cache key.
208
+ */
209
+ $expiration = apply_filters( "crp_cache_time_{$key}", $expiration, $post_id, $key, $value );
210
+
211
+ $meta_key = '_crp_cache_' . $key;
212
+ $cache_expires = '_crp_cache_expires_' . $key;
213
+
214
+ $updated = update_post_meta( $post_id, $meta_key, $value, '' );
215
+ update_post_meta( $post_id, $cache_expires, time() + $expiration, '' );
216
+
217
+ return $updated;
218
+ }
219
+
220
+ /**
221
+ * Get the value of the CRP cache for a post.
222
+ *
223
+ * @since 3.0.0
224
+ *
225
+ * @param int $post_id Post ID.
226
+ * @param string $key CRP Cache key.
227
+ * @return mixed Value of the CRP cache or false if invalid, expired or unavailable.
228
+ */
229
+ function get_crp_cache( $post_id, $key ) {
230
+ $meta_key = '_crp_cache_' . $key;
231
+ $cache_expires = '_crp_cache_expires_' . $key;
232
+
233
+ $value = get_post_meta( $post_id, $meta_key, true );
234
+
235
+ if ( $value ) {
236
+ $expires = (int) get_post_meta( $post_id, $cache_expires, true );
237
+ if ( $expires < time() || empty( $expires ) ) {
238
+ delete_crp_cache( $post_id, $meta_key );
239
+ return false;
240
+ } else {
241
+ return $value;
242
+ }
243
+ }
244
+ }
245
+
246
+
247
+ /**
248
+ * Delete the value of the CRP cache for a post.
249
+ *
250
+ * @since 3.0.0
251
+ *
252
+ * @param int $post_id Post ID.
253
+ * @param string $key CRP Cache key.
254
+ * @return bool True on success, False on failure.
255
+ */
256
+ function delete_crp_cache( $post_id, $key ) {
257
+ $meta_key = '_crp_cache_' . $key;
258
+ $cache_expires = '_crp_cache_expires_' . $key;
259
+
260
+ $result = delete_post_meta( $post_id, $meta_key );
261
+ if ( $result ) {
262
+ delete_post_meta( $post_id, $cache_expires );
263
+ }
264
+
265
+ return $result;
266
+ }
267
+
includes/modules/class-crp-widget.php CHANGED
@@ -3,10 +3,6 @@
3
  * Widget class.
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -227,7 +223,7 @@ class CRP_Widget extends WP_Widget {
227
  }
228
  }
229
  $instance['include_cat_ids'] = isset( $include_cat_ids ) ? join( ',', $include_cat_ids ) : '';
230
- $instance['include_categories'] = isset( $include_cat_names ) ? tptn_str_putcsv( $include_cat_names ) : '';
231
 
232
  delete_post_meta_by_key( 'crp_related_posts_widget' ); // Delete the cache.
233
 
3
  * Widget class.
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
223
  }
224
  }
225
  $instance['include_cat_ids'] = isset( $include_cat_ids ) ? join( ',', $include_cat_ids ) : '';
226
+ $instance['include_categories'] = isset( $include_cat_names ) ? crp_str_putcsv( $include_cat_names ) : '';
227
 
228
  delete_post_meta_by_key( 'crp_related_posts_widget' ); // Delete the cache.
229
 
includes/modules/manual-posts.php CHANGED
@@ -4,10 +4,6 @@
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Manual_Posts
7
- * @author Ajay D'Souza
8
- * @license GPL-2.0+
9
- * @link https://webberzone.com
10
- * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Manual_Posts
 
 
 
 
7
  */
8
 
9
  // If this file is called directly, abort.
includes/modules/shortcode.php CHANGED
@@ -4,10 +4,6 @@
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Shortcode
7
- * @author Ajay D'Souza
8
- * @license GPL-2.0+
9
- * @link https://webberzone.com
10
- * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
@@ -31,10 +27,11 @@ 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
- 'include_cat_ids' => '',
 
38
  )
39
  ),
40
  $atts,
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Shortcode
 
 
 
 
7
  */
8
 
9
  // If this file is called directly, abort.
27
  array_merge(
28
  $crp_settings,
29
  array(
30
+ 'heading' => 1,
31
+ 'is_shortcode' => 1,
32
+ 'offset' => 0,
33
+ 'include_cat_ids' => '',
34
+ 'include_post_ids' => '',
35
  )
36
  ),
37
  $atts,
includes/modules/taxonomies.php CHANGED
@@ -4,10 +4,6 @@
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Manual_Posts
7
- * @author Ajay D'Souza
8
- * @license GPL-2.0+
9
- * @link https://webberzone.com
10
- * @copyright 2009-2020 Ajay D'Souza
11
  */
12
 
13
  // If this file is called directly, abort.
4
  *
5
  * @package Contextual_Related_Posts
6
  * @subpackage Manual_Posts
 
 
 
 
7
  */
8
 
9
  // If this file is called directly, abort.
includes/output-generator.php CHANGED
@@ -3,10 +3,6 @@
3
  * Generates the output
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -299,7 +295,7 @@ function crp_list_link( $args, $result ) {
299
  $link = crp_permalink( $args, $result );
300
  $link_attributes = crp_link_attributes( $args );
301
 
302
- $output .= '<a href="' . $link . '" ' . $link_attributes . ' class="' . $result->post_type . '-' . $result->ID . '">';
303
 
304
  if ( 'after' === $args['post_thumb_op'] ) {
305
  $output .= '<span class="crp_title">' . $title . '</span>'; // Add title when required by settings.
3
  * Generates the output
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
295
  $link = crp_permalink( $args, $result );
296
  $link_attributes = crp_link_attributes( $args );
297
 
298
+ $output .= '<a href="' . $link . '" ' . $link_attributes . ' class="crp_link ' . $result->post_type . '-' . $result->ID . '">';
299
 
300
  if ( 'after' === $args['post_thumb_op'] ) {
301
  $output .= '<span class="crp_title">' . $title . '</span>'; // Add title when required by settings.
includes/plugin-activator.php CHANGED
@@ -3,10 +3,6 @@
3
  * Fired during plugin activation
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
3
  * Fired during plugin activation
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
includes/tools.php CHANGED
@@ -3,10 +3,6 @@
3
  * Tool functions
4
  *
5
  * @package Contextual_Related_Posts
6
- * @author Ajay D'Souza
7
- * @license GPL-2.0+
8
- * @link https://webberzone.com
9
- * @copyright 2009-2020 Ajay D'Souza
10
  */
11
 
12
  // If this file is called directly, abort.
@@ -18,16 +14,18 @@ if ( ! defined( 'WPINC' ) ) {
18
  * Function to create an excerpt for the post.
19
  *
20
  * @since 1.6
 
21
  *
22
- * @param int $id Post ID.
23
- * @param int|string $excerpt_length Length of the excerpt in words.
24
- * @param bool $use_excerpt Use excerpt instead of content.
 
25
  * @return string Excerpt
26
  */
27
- function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
28
  $content = '';
29
 
30
- $post = get_post( $id );
31
  if ( empty( $post ) ) {
32
  return '';
33
  }
@@ -45,21 +43,68 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
45
  *
46
  * @since 2.3.0
47
  * @since 2.9.0 Added $content parameter
 
48
  *
49
- * @param string $output Formatted excerpt
50
- * @param int $id Post ID
51
- * @param int $excerpt_length Length of the excerpt
52
- * @param boolean $use_excerpt Use the excerpt?
53
- * @param string $content Content that is used to create the excerpt.
54
  */
55
- $output = apply_filters( 'crp_excerpt_pre_trim', $output, $id, $excerpt_length, $use_excerpt, $content );
56
 
57
  if ( 0 === (int) $excerpt_length || CRP_MAX_WORDS < (int) $excerpt_length ) {
58
  $excerpt_length = CRP_MAX_WORDS;
59
  }
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  if ( $excerpt_length > 0 ) {
62
- $output = wp_trim_words( $output, $excerpt_length );
 
 
63
  }
64
 
65
  if ( post_password_required( $post ) ) {
@@ -69,14 +114,15 @@ function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
69
  /**
70
  * Filters excerpt generated by CRP.
71
  *
72
- * @since 1.9
 
73
  *
74
- * @param string $output Formatted excerpt
75
- * @param int $id Post ID
76
- * @param int $excerpt_length Length of the excerpt
77
- * @param boolean $use_excerpt Use the excerpt?
78
  */
79
- return apply_filters( 'crp_excerpt', $output, $id, $excerpt_length, $use_excerpt );
80
  }
81
 
82
 
@@ -138,9 +184,6 @@ function crp_create_index() {
138
  if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
139
  $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
140
  }
141
- if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_content'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
142
- $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_content (post_content);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
143
- }
144
 
145
  $wpdb->show_errors();
146
 
3
  * Tool functions
4
  *
5
  * @package Contextual_Related_Posts
 
 
 
 
6
  */
7
 
8
  // If this file is called directly, abort.
14
  * Function to create an excerpt for the post.
15
  *
16
  * @since 1.6
17
+ * @since 3.0.0 Added $more_link_text parameter.
18
  *
19
+ * @param int|WP_Post $post Post ID or WP_Post instance.
20
+ * @param int|string $excerpt_length Length of the excerpt in words.
21
+ * @param bool $use_excerpt Use excerpt instead of content.
22
+ * @param string $more_link_text Content for when there is more text. Default is null.
23
  * @return string Excerpt
24
  */
25
+ function crp_excerpt( $post, $excerpt_length = 0, $use_excerpt = true, $more_link_text = '' ) {
26
  $content = '';
27
 
28
+ $post = get_post( $post );
29
  if ( empty( $post ) ) {
30
  return '';
31
  }
43
  *
44
  * @since 2.3.0
45
  * @since 2.9.0 Added $content parameter
46
+ * @since 3.0.0 Changed second parameter to WP_Post instance instead of ID.
47
  *
48
+ * @param string $output Formatted excerpt.
49
+ * @param WP_Post $post Source Post instance.
50
+ * @param int $excerpt_length Length of the excerpt.
51
+ * @param boolean $use_excerpt Use the excerpt?
52
+ * @param string $content Content that is used to create the excerpt.
53
  */
54
+ $output = apply_filters( 'crp_excerpt_pre_trim', $output, $post, $excerpt_length, $use_excerpt, $content );
55
 
56
  if ( 0 === (int) $excerpt_length || CRP_MAX_WORDS < (int) $excerpt_length ) {
57
  $excerpt_length = CRP_MAX_WORDS;
58
  }
59
 
60
+ /**
61
+ * Filters the Read More text of the CRP excerpt.
62
+ *
63
+ * @since 3.0.0
64
+ *
65
+ * @param string $more_link_text Read More text.
66
+ * @param WP_Post $post Source Post instance.
67
+ */
68
+ $more_link_text = apply_filters( 'crp_excerpt_more_link_text', $more_link_text, $post );
69
+
70
+ if ( null === $more_link_text ) {
71
+ $more_link_text = sprintf(
72
+ '<span aria-label="%1$s">%2$s</span>',
73
+ sprintf(
74
+ /* translators: %s: Post title. */
75
+ __( 'Continue reading %s', 'contextual-related-posts' ),
76
+ the_title_attribute(
77
+ array(
78
+ 'echo' => false,
79
+ 'post' => $post,
80
+ )
81
+ )
82
+ ),
83
+ __( '(more&hellip;)', 'contextual-related-posts' )
84
+ );
85
+ }
86
+
87
+ if ( ! empty( $more_link_text ) ) {
88
+ $more_link_element = ' <a href="' . get_permalink( $post ) . "#more-{$post->ID}\" class=\"crp_read_more_link\">$more_link_text</a>";
89
+ } else {
90
+ $more_link_element = '';
91
+ }
92
+
93
+ /**
94
+ * Filters the Read More link text of the CRP excerpt.
95
+ *
96
+ * @since 3.0.0
97
+ *
98
+ * @param string $more_link_element Read More link element.
99
+ * @param string $more_link_text Read More text.
100
+ * @param WP_Post $post Source Post instance.
101
+ */
102
+ $more_link_element = apply_filters( 'crp_excerpt_more_link', $more_link_element, $more_link_text, $post );
103
+
104
  if ( $excerpt_length > 0 ) {
105
+ $more_link_element = empty( $more_link_element ) ? null : $more_link_element;
106
+
107
+ $output = wp_trim_words( $output, $excerpt_length, $more_link_element );
108
  }
109
 
110
  if ( post_password_required( $post ) ) {
114
  /**
115
  * Filters excerpt generated by CRP.
116
  *
117
+ * @since 1.9
118
+ * @since 3.0.0 Changed second parameter to WP_Post instance instead of ID.
119
  *
120
+ * @param string $output Formatted excerpt.
121
+ * @param WP_Post $post Source Post instance.
122
+ * @param int $excerpt_length Length of the excerpt.
123
+ * @param boolean $use_excerpt Use the excerpt?
124
  */
125
+ return apply_filters( 'crp_excerpt', $output, $post, $excerpt_length, $use_excerpt );
126
  }
127
 
128
 
184
  if ( ! $wpdb->get_results( "SHOW INDEX FROM {$wpdb->posts} where Key_name = 'crp_related_title'" ) ) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
185
  $wpdb->query( "ALTER TABLE {$wpdb->posts} ADD FULLTEXT crp_related_title (post_title);" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange
186
  }
 
 
 
187
 
188
  $wpdb->show_errors();
189
 
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-06-14 22:38+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone\n"
@@ -22,8 +22,8 @@ msgstr ""
22
  msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
- #: includes/admin/admin.php:32 includes/admin/default-settings.php:193
26
- #: includes/deprecated.php:183
27
  msgid "Related Posts"
28
  msgstr ""
29
 
@@ -31,7 +31,7 @@ msgstr ""
31
  msgid "Contextual Related Posts Tools"
32
  msgstr ""
33
 
34
- #: includes/admin/admin.php:42
35
  msgid "Tools"
36
  msgstr ""
37
 
@@ -93,13 +93,13 @@ msgstr ""
93
 
94
  #: includes/admin/blocks/related-posts/index.js:173
95
  #: includes/admin/blocks/related-posts/index.min.js:1
96
- #: includes/admin/default-settings.php:240
97
  msgid "Show author"
98
  msgstr ""
99
 
100
  #: includes/admin/blocks/related-posts/index.js:178
101
  #: includes/admin/blocks/related-posts/index.min.js:1
102
- #: includes/admin/default-settings.php:233
103
  msgid "Show date"
104
  msgstr ""
105
 
@@ -136,7 +136,7 @@ msgstr ""
136
 
137
  #: includes/admin/blocks/related-posts/index.js:200
138
  #: includes/admin/blocks/related-posts/index.min.js:1
139
- #: includes/admin/default-settings.php:371
140
  msgid "Randomize posts"
141
  msgstr ""
142
 
@@ -238,227 +238,269 @@ msgid ""
238
  msgstr ""
239
 
240
  #: includes/admin/default-settings.php:111
241
- msgid "Disable on mobile devices"
242
  msgstr ""
243
 
244
  #: includes/admin/default-settings.php:112
245
  msgid ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  "Disable display of related posts on mobile devices. Might not always work "
247
  "with caching plugins."
248
  msgstr ""
249
 
250
- #: includes/admin/default-settings.php:118
251
  msgid "Disable on AMP pages"
252
  msgstr ""
253
 
254
- #: includes/admin/default-settings.php:119
255
  msgid "Disable display of related posts on AMP pages."
256
  msgstr ""
257
 
258
- #: includes/admin/default-settings.php:125
259
  msgid "Delete options on uninstall"
260
  msgstr ""
261
 
262
- #: includes/admin/default-settings.php:126
263
  msgid ""
264
  "If this is checked, all settings related to Contextual Related Posts are "
265
  "removed from the database if you choose to uninstall/delete the plugin."
266
  msgstr ""
267
 
268
- #: includes/admin/default-settings.php:132
269
  msgid "Delete FULLTEXT indices on uninstall"
270
  msgstr ""
271
 
272
- #: includes/admin/default-settings.php:133
273
  msgid ""
274
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
275
  "are removed from the database if you choose to uninstall/delete the plugin."
276
  msgstr ""
277
 
278
- #: includes/admin/default-settings.php:139
279
  msgid "Delete FULLTEXT indices on deactivate"
280
  msgstr ""
281
 
282
- #: includes/admin/default-settings.php:140
283
  msgid ""
284
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
285
  "are removed from the database if you choose to deactivate the plugin."
286
  msgstr ""
287
 
288
- #: includes/admin/default-settings.php:146
289
  msgid "Show metabox"
290
  msgstr ""
291
 
292
- #: includes/admin/default-settings.php:147
293
  msgid ""
294
  "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
295
  "Posts screens. Also applies to Pages and Custom Post Types."
296
  msgstr ""
297
 
298
- #: includes/admin/default-settings.php:153
299
  msgid "Limit meta box to Admins only"
300
  msgstr ""
301
 
302
- #: includes/admin/default-settings.php:154
303
  msgid ""
304
  "If selected, the meta box will be hidden from anyone who is not an Admin. By "
305
  "default, Contributors and above will be able to see the meta box. Applies "
306
  "only if the above option is selected."
307
  msgstr ""
308
 
309
- #: includes/admin/default-settings.php:160
310
  msgid "Link to Contextual Related Posts plugin page"
311
  msgstr ""
312
 
313
- #: includes/admin/default-settings.php:161
314
  msgid ""
315
  "A no-follow link to the plugin homepage will be added as the last item of "
316
  "the related posts."
317
  msgstr ""
318
 
319
- #: includes/admin/default-settings.php:190
320
  msgid "Heading of posts"
321
  msgstr ""
322
 
323
- #: includes/admin/default-settings.php:191
324
  msgid "Displayed before the list of the posts as a master heading"
325
  msgstr ""
326
 
327
- #: includes/admin/default-settings.php:198
328
  msgid "Show when no posts are found"
329
  msgstr ""
330
 
331
- #: includes/admin/default-settings.php:204
332
  msgid "Blank output"
333
  msgstr ""
334
 
335
- #: includes/admin/default-settings.php:205
336
  msgid "Display custom text"
337
  msgstr ""
338
 
339
- #: includes/admin/default-settings.php:210
340
  msgid "Custom text"
341
  msgstr ""
342
 
343
- #: includes/admin/default-settings.php:211
344
  msgid ""
345
  "Enter the custom text that will be displayed if the second option is "
346
  "selected above."
347
  msgstr ""
348
 
349
- #: includes/admin/default-settings.php:213 includes/deprecated.php:185
350
  msgid "No related posts found"
351
  msgstr ""
352
 
353
- #: includes/admin/default-settings.php:217
354
- #: includes/admin/default-settings.php:645
355
  msgid "Show post excerpt"
356
  msgstr ""
357
 
358
- #: includes/admin/default-settings.php:218
359
  msgid ""
360
  "If the post does not have an excerpt, the plugin will automatically create "
361
  "one containing the number of words specified in the next option."
362
  msgstr ""
363
 
364
- #: includes/admin/default-settings.php:224
365
  msgid "Length of excerpt (in words)"
366
  msgstr ""
367
 
368
- #: includes/admin/default-settings.php:234
369
  msgid ""
370
  "Displays the date of the post. Uses the same date format set in General "
371
  "Options."
372
  msgstr ""
373
 
374
- #: includes/admin/default-settings.php:247
375
  msgid "Limit post title length (in characters)"
376
  msgstr ""
377
 
378
- #: includes/admin/default-settings.php:248
379
  msgid ""
380
  "Any title longer than the number of characters set above will be cut and "
381
  "appended with an ellipsis (&hellip;)"
382
  msgstr ""
383
 
384
- #: includes/admin/default-settings.php:255
385
  msgid "Open links in new window"
386
  msgstr ""
387
 
388
- #: includes/admin/default-settings.php:262
389
  msgid "Add nofollow to links"
390
  msgstr ""
391
 
392
- #: includes/admin/default-settings.php:269
393
  msgid "Exclusion settings"
394
  msgstr ""
395
 
396
- #: includes/admin/default-settings.php:275
397
  msgid "Exclude display on these posts"
398
  msgstr ""
399
 
400
- #: includes/admin/default-settings.php:276
401
  msgid ""
402
  "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
403
  msgstr ""
404
 
405
- #: includes/admin/default-settings.php:282
406
  msgid "Exclude display on these post types"
407
  msgstr ""
408
 
409
- #: includes/admin/default-settings.php:283
410
  msgid ""
411
  "The related posts will not display on any of the above selected post types."
412
  msgstr ""
413
 
414
- #: includes/admin/default-settings.php:289
 
 
 
 
 
 
 
 
 
 
 
 
415
  msgid "HTML to display"
416
  msgstr ""
417
 
418
- #: includes/admin/default-settings.php:295
419
  msgid "Before the list of posts"
420
  msgstr ""
421
 
422
- #: includes/admin/default-settings.php:302
423
  msgid "After the list of posts"
424
  msgstr ""
425
 
426
- #: includes/admin/default-settings.php:309
427
  msgid "Before each list item"
428
  msgstr ""
429
 
430
- #: includes/admin/default-settings.php:316
431
  msgid "After each list item"
432
  msgstr ""
433
 
434
- #: includes/admin/default-settings.php:346
435
- #: includes/admin/default-settings.php:636
436
  msgid "Number of posts to display"
437
  msgstr ""
438
 
439
- #: includes/admin/default-settings.php:347
440
  msgid ""
441
  "Maximum number of posts that will be displayed in the list. This option is "
442
  "used if you do not specify the number of posts in the widget or shortcodes"
443
  msgstr ""
444
 
445
- #: includes/admin/default-settings.php:355
446
  msgid "Related posts should be newer than"
447
  msgstr ""
448
 
449
- #: includes/admin/default-settings.php:356
450
  msgid ""
451
  "This sets the cut-off period for which posts will be displayed. e.g. setting "
452
  "it to 365 will show related posts from the last year only. Set to 0 to "
453
  "disable limiting posts by date."
454
  msgstr ""
455
 
456
- #: includes/admin/default-settings.php:363
457
  #: includes/modules/class-crp-widget.php:132
458
  msgid "Order posts"
459
  msgstr ""
460
 
461
- #: includes/admin/default-settings.php:372
462
  msgid ""
463
  "This shuffles the selected related posts. If you select to order by date in "
464
  "the previous option, then the related posts will first be sorted by date and "
@@ -466,86 +508,79 @@ msgid ""
466
  "enabled."
467
  msgstr ""
468
 
469
- #: includes/admin/default-settings.php:378
470
  msgid "Related posts based on title and content"
471
  msgstr ""
472
 
473
- #: includes/admin/default-settings.php:379
474
  msgid ""
475
  "If unchecked, only posts titles are used. Enable the cache if enabling this "
476
  "option for better performance. Each site is different, so toggle this option "
477
  "to see which setting gives you better quality related posts."
478
  msgstr ""
479
 
480
- #: includes/admin/default-settings.php:385
481
  msgid "Limit content to be compared"
482
  msgstr ""
483
 
484
- #: includes/admin/default-settings.php:387
485
  #, php-format
486
  msgid ""
487
  "This sets the maximum words of the content that will be matched. Set to 0 "
488
  "for no limit. Max value: %1$s. Only applies if you activate the above option."
489
  msgstr ""
490
 
491
- #: includes/admin/default-settings.php:395
492
  #: includes/modules/class-crp-widget.php:156
493
  msgid "Post types to include"
494
  msgstr ""
495
 
496
- #: includes/admin/default-settings.php:396
497
  msgid ""
498
  "At least one option should be selected above. Select which post types you "
499
  "want to include in the list of posts. This field can be overridden using a "
500
  "comma separated list of post types when using the manual display."
501
  msgstr ""
502
 
503
- #: includes/admin/default-settings.php:402
504
  msgid "Limit to same post type"
505
  msgstr ""
506
 
507
- #: includes/admin/default-settings.php:403
508
  msgid ""
509
  "If checked, the related posts will only be selected from the same post type "
510
  "of the current post."
511
  msgstr ""
512
 
513
- #: includes/admin/default-settings.php:409
514
  msgid "Limit to same author"
515
  msgstr ""
516
 
517
- #: includes/admin/default-settings.php:410
518
  msgid ""
519
  "If checked, the related posts will only be selected from the same author of "
520
  "the current post."
521
  msgstr ""
522
 
523
- #: includes/admin/default-settings.php:416
524
  msgid "Post/page IDs to exclude"
525
  msgstr ""
526
 
527
- #: includes/admin/default-settings.php:417
528
  msgid ""
529
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
530
  "188,320,500"
531
  msgstr ""
532
 
533
- #: includes/admin/default-settings.php:423
534
  msgid "Exclude Categories"
535
  msgstr ""
536
 
537
- #: includes/admin/default-settings.php:424
538
- msgid ""
539
- "Comma separated list of category slugs. The field above has an autocomplete "
540
- "so simply start typing in the starting letters and it will prompt you with "
541
- "options. Does not support custom taxonomies."
542
- msgstr ""
543
-
544
- #: includes/admin/default-settings.php:435
545
  msgid "Exclude category IDs"
546
  msgstr ""
547
 
548
- #: includes/admin/default-settings.php:436
549
  msgid ""
550
  "This is a readonly field that is automatically populated based on the above "
551
  "input when the settings are saved. These might differ from the IDs visible "
@@ -553,36 +588,59 @@ msgid ""
553
  "the term_taxonomy_id which is unique to this taxonomy."
554
  msgstr ""
555
 
556
- #: includes/admin/default-settings.php:466
557
- #: includes/admin/default-settings.php:652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  msgid "Location of the post thumbnail"
559
  msgstr ""
560
 
561
- #: includes/admin/default-settings.php:471
562
- #: includes/admin/default-settings.php:657
563
  msgid "Display thumbnails inline with posts, before title"
564
  msgstr ""
565
 
566
- #: includes/admin/default-settings.php:472
567
- #: includes/admin/default-settings.php:658
568
  msgid "Display thumbnails inline with posts, after title"
569
  msgstr ""
570
 
571
- #: includes/admin/default-settings.php:473
572
- #: includes/admin/default-settings.php:659
573
  msgid "Display only thumbnails, no text"
574
  msgstr ""
575
 
576
- #: includes/admin/default-settings.php:474
577
- #: includes/admin/default-settings.php:660
578
  msgid "Do not display thumbnails, only text"
579
  msgstr ""
580
 
581
- #: includes/admin/default-settings.php:479
582
  msgid "Thumbnail size"
583
  msgstr ""
584
 
585
- #: includes/admin/default-settings.php:480
586
  msgid ""
587
  "You can choose from existing image sizes above or create a custom size. If "
588
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -590,125 +648,125 @@ msgid ""
590
  "width and/or height below, existing images will not be automatically resized."
591
  msgstr ""
592
 
593
- #: includes/admin/default-settings.php:482
594
  #, php-format
595
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
596
  msgstr ""
597
 
598
- #: includes/admin/default-settings.php:492
599
- #: includes/admin/default-settings.php:665
600
  #: includes/modules/class-crp-widget.php:129
601
  msgid "Thumbnail width"
602
  msgstr ""
603
 
604
- #: includes/admin/default-settings.php:501
605
- #: includes/admin/default-settings.php:674
606
  #: includes/modules/class-crp-widget.php:124
607
  msgid "Thumbnail height"
608
  msgstr ""
609
 
610
- #: includes/admin/default-settings.php:510
611
  msgid "Hard crop thumbnails"
612
  msgstr ""
613
 
614
- #: includes/admin/default-settings.php:511
615
  msgid ""
616
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
617
  "above vs. maintaining proportions."
618
  msgstr ""
619
 
620
- #: includes/admin/default-settings.php:517
621
  msgid "Generate thumbnail sizes"
622
  msgstr ""
623
 
624
- #: includes/admin/default-settings.php:518
625
  msgid ""
626
  "If you select this option and Custom size is selected above, the plugin will "
627
  "register the image size with WordPress to create new thumbnails. Does not "
628
  "update old images as explained above."
629
  msgstr ""
630
 
631
- #: includes/admin/default-settings.php:524
632
  msgid "Thumbnail size attributes"
633
  msgstr ""
634
 
635
- #: includes/admin/default-settings.php:530
636
  #, php-format
637
  msgid "Use CSS to set the width and height: e.g. %s"
638
  msgstr ""
639
 
640
- #: includes/admin/default-settings.php:532
641
  #, php-format
642
  msgid "Use HTML attributes to set the width and height: e.g. %s"
643
  msgstr ""
644
 
645
- #: includes/admin/default-settings.php:533
646
  msgid ""
647
  "No width or height set. You will need to use external styles to force any "
648
  "width or height of your choice."
649
  msgstr ""
650
 
651
- #: includes/admin/default-settings.php:538
652
  msgid "Thumbnail meta field name"
653
  msgstr ""
654
 
655
- #: includes/admin/default-settings.php:539
656
  msgid ""
657
  "The value of this field should contain the URL of the image and can be set "
658
  "in the metabox in the Edit Post screen"
659
  msgstr ""
660
 
661
- #: includes/admin/default-settings.php:545
662
  msgid "Get first image"
663
  msgstr ""
664
 
665
- #: includes/admin/default-settings.php:546
666
  msgid ""
667
  "The plugin will fetch the first image in the post content if this is "
668
  "enabled. This can slow down the loading of your page if the first image in "
669
  "the followed posts is large in file-size."
670
  msgstr ""
671
 
672
- #: includes/admin/default-settings.php:552
673
  msgid "Use default thumbnail?"
674
  msgstr ""
675
 
676
- #: includes/admin/default-settings.php:553
677
  msgid ""
678
  "If checked, when no thumbnail is found, show a default one from the URL "
679
  "below. If not checked and no thumbnail is found, no image will be shown."
680
  msgstr ""
681
 
682
- #: includes/admin/default-settings.php:559 includes/admin/settings-page.php:748
683
  msgid "Default thumbnail"
684
  msgstr ""
685
 
686
- #: includes/admin/default-settings.php:560
687
  msgid ""
688
  "Enter the full URL of the image that you wish to display if no thumbnail is "
689
  "found. This image will be displayed below."
690
  msgstr ""
691
 
692
- #: includes/admin/default-settings.php:590
693
  msgid "Related Posts style"
694
  msgstr ""
695
 
696
- #: includes/admin/default-settings.php:598
697
  msgid "Custom CSS"
698
  msgstr ""
699
 
700
- #: includes/admin/default-settings.php:600
701
  #, php-format
702
  msgid ""
703
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
704
  "CSS classes to style."
705
  msgstr ""
706
 
707
- #: includes/admin/default-settings.php:630
708
  msgid "About this tab"
709
  msgstr ""
710
 
711
- #: includes/admin/default-settings.php:631
712
  msgid ""
713
  "Below options override the related posts settings for your blog feed. These "
714
  "only apply if you have selected to add related posts to Feeds in the General "
@@ -716,183 +774,127 @@ msgid ""
716
  "way to style the related posts in the feed."
717
  msgstr ""
718
 
719
- #: includes/admin/default-settings.php:751
720
  msgid "No styles"
721
  msgstr ""
722
 
723
- #: includes/admin/default-settings.php:752
724
  msgid "Select this option if you plan to add your own styles"
725
  msgstr ""
726
 
727
- #: includes/admin/default-settings.php:756
728
  msgid "Text only"
729
  msgstr ""
730
 
731
- #: includes/admin/default-settings.php:757
732
  msgid "Disable thumbnails and no longer include the default style sheet"
733
  msgstr ""
734
 
735
- #: includes/admin/default-settings.php:761
736
  msgid "Rounded thumbnails"
737
  msgstr ""
738
 
739
- #: includes/admin/default-settings.php:762
740
- msgid ""
741
- "Enabling this option will turn on the thumbnails and force their width and "
742
- "height. It will also turn off the display of the author, excerpt and date if "
743
- "already enabled. Disabling this option will not revert any settings."
744
- msgstr ""
745
-
746
- #: includes/admin/default-settings.php:785
747
- msgid "By relevance"
748
- msgstr ""
749
-
750
- #: includes/admin/default-settings.php:786
751
- msgid "Randomly"
752
- msgstr ""
753
-
754
- #: includes/admin/default-settings.php:787
755
- msgid "By date"
756
- msgstr ""
757
-
758
- #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
759
- #, php-format
760
- msgid ""
761
- "For more information or how to get support visit the <a href=\"%1$s"
762
- "\">WebberZone support site</a>."
763
- msgstr ""
764
-
765
- #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
766
- #, php-format
767
  msgid ""
768
- "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
769
- "support forums</a>."
 
770
  msgstr ""
771
 
772
- #: includes/admin/help-tab.php:40 includes/admin/help-tab.php:131
773
- #, php-format
774
- msgid ""
775
- "<a href=\"%1$s\">Post an issue</a> on <a href=\"%2$s\">GitHub</a> (bug "
776
- "reports only)."
777
  msgstr ""
778
 
779
- #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
780
- #: includes/admin/settings-page.php:129
781
- msgid "General"
782
  msgstr ""
783
 
784
- #: includes/admin/help-tab.php:51
785
- msgid ""
786
- "This screen provides the basic settings for configuring Contextual Related "
787
- "Posts."
788
  msgstr ""
789
 
790
- #: includes/admin/help-tab.php:52
791
- msgid ""
792
- "Enable the trackers and cache, configure basic tracker settings and "
793
- "uninstall settings."
794
  msgstr ""
795
 
796
- #: includes/admin/help-tab.php:59
797
- msgid "Counter/Tracker"
798
  msgstr ""
799
 
800
- #: includes/admin/help-tab.php:61
801
  msgid ""
802
- "This screen provides settings to tweak the display counter and the tracker."
 
803
  msgstr ""
804
 
805
- #: includes/admin/help-tab.php:62
806
- msgid ""
807
- "Choose where to display the counter and customize the text. Select the type "
808
- "of tracker and which user groups to track."
809
  msgstr ""
810
 
811
- #: includes/admin/help-tab.php:69
812
- msgid "Posts list"
813
  msgstr ""
814
 
815
- #: includes/admin/help-tab.php:71
816
- msgid ""
817
- "This screen provides settings to tweak the output of the list of related "
818
- "posts."
819
  msgstr ""
820
 
821
- #: includes/admin/help-tab.php:72
 
822
  msgid ""
823
- "Set the number of posts, which categories or posts to exclude, customize "
824
- "what to display and specific basic HTML markup used to create the posts."
825
- msgstr ""
826
-
827
- #: includes/admin/help-tab.php:79 includes/admin/settings-page.php:132
828
- msgid "Thumbnail"
829
  msgstr ""
830
 
831
- #: includes/admin/help-tab.php:81
 
832
  msgid ""
833
- "This screen provides settings to tweak the thumbnail that can be displayed "
834
- "for each post in the list."
835
  msgstr ""
836
 
837
- #: includes/admin/help-tab.php:82
 
838
  msgid ""
839
- "Set the location and size of the thumbnail. Additionally, you can choose "
840
- "additional sources for the thumbnail i.e. a meta field, first image or a "
841
- "default thumbnail when nothing is available."
842
  msgstr ""
843
 
844
- #: includes/admin/help-tab.php:89 includes/admin/settings-page.php:133
845
- msgid "Styles"
846
  msgstr ""
847
 
848
- #: includes/admin/help-tab.php:91
849
  msgid ""
850
- "This screen provides options to control the look and feel of the related "
851
- "posts list."
852
  msgstr ""
853
 
854
- #: includes/admin/help-tab.php:92
 
855
  msgid ""
856
- "Choose for default set of styles or add your own custom CSS to tweak the "
857
- "display of the posts."
858
- msgstr ""
859
-
860
- #: includes/admin/help-tab.php:99
861
- msgid "Maintenance"
862
- msgstr ""
863
-
864
- #: includes/admin/help-tab.php:101
865
- msgid "This screen provides options to control the maintenance cron."
866
- msgstr ""
867
-
868
- #: includes/admin/help-tab.php:102
869
- msgid "Choose how often to run maintenance and at what time of the day."
870
  msgstr ""
871
 
872
- #: includes/admin/help-tab.php:142
873
  msgid ""
874
  "This screen provides some tools that help maintain certain features of "
875
  "Contextual Related Posts."
876
  msgstr ""
877
 
878
- #: includes/admin/help-tab.php:143
879
  msgid ""
880
- "Clear the cache, reset the related posts tables plus some miscellaneous "
881
- "fixes for older versions of Contextual Related Posts."
 
882
  msgstr ""
883
 
884
- #: includes/admin/modules/cache.php:54
 
885
  msgid ""
886
- "An error occurred clearing the cache. Please contact your site administrator."
887
- "\\n\\nError message:\\n"
888
- msgstr ""
889
-
890
- #: includes/admin/modules/cache.php:63
891
- msgid " cached row(s) cleared"
892
- msgstr ""
893
-
894
- #: includes/admin/modules/loader.php:29
895
- msgid "Settings"
896
  msgstr ""
897
 
898
  #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
@@ -1070,11 +1072,11 @@ msgid ""
1070
  "should do this only if you are comfortable with the new settings."
1071
  msgstr ""
1072
 
1073
- #: includes/admin/modules/tools.php:239
1074
  msgid "Please upload a valid .json file"
1075
  msgstr ""
1076
 
1077
- #: includes/admin/modules/tools.php:245
1078
  msgid "Please upload a file to import"
1079
  msgstr ""
1080
 
@@ -1120,6 +1122,10 @@ msgstr ""
1120
  msgid "Reset all settings"
1121
  msgstr ""
1122
 
 
 
 
 
1123
  #: includes/admin/settings-page.php:130
1124
  msgid "List tuning"
1125
  msgstr ""
@@ -1128,6 +1134,14 @@ msgstr ""
1128
  msgid "Output"
1129
  msgstr ""
1130
 
 
 
 
 
 
 
 
 
1131
  #: includes/admin/settings-page.php:134
1132
  msgid "Feed"
1133
  msgstr ""
@@ -1142,14 +1156,14 @@ msgstr ""
1142
  msgid "Modified from default setting"
1143
  msgstr ""
1144
 
1145
- #: includes/admin/settings-page.php:770
1146
  msgid ""
1147
  "This option cannot be changed because of the selected related posts style. "
1148
  "To modify this option, you will need to select No styles or Text only in the "
1149
  "Styles tab"
1150
  msgstr ""
1151
 
1152
- #: includes/admin/settings-page.php:774
1153
  msgid ""
1154
  "This option cannot be changed because of the selected related posts style. "
1155
  "To modify this option, you will need to select No styles in the Styles tab"
@@ -1203,7 +1217,7 @@ msgstr ""
1203
  msgid "Follow me"
1204
  msgstr ""
1205
 
1206
- #: includes/main-query.php:245
1207
  #, php-format
1208
  msgid ""
1209
  "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
@@ -1270,6 +1284,15 @@ msgstr ""
1270
  msgid " by "
1271
  msgstr ""
1272
 
1273
- #: includes/tools.php:66
 
 
 
 
 
 
 
 
 
1274
  msgid "There is no excerpt because this is a protected post."
1275
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Contextual Related Posts\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2021-01-07 18:05+0000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: WebberZone\n"
22
  msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
+ #: includes/admin/admin.php:32 includes/admin/default-settings.php:215
26
+ #: includes/deprecated.php:147
27
  msgid "Related Posts"
28
  msgstr ""
29
 
31
  msgid "Contextual Related Posts Tools"
32
  msgstr ""
33
 
34
+ #: includes/admin/admin.php:42 includes/admin/help-tab.php:57
35
  msgid "Tools"
36
  msgstr ""
37
 
93
 
94
  #: includes/admin/blocks/related-posts/index.js:173
95
  #: includes/admin/blocks/related-posts/index.min.js:1
96
+ #: includes/admin/default-settings.php:262
97
  msgid "Show author"
98
  msgstr ""
99
 
100
  #: includes/admin/blocks/related-posts/index.js:178
101
  #: includes/admin/blocks/related-posts/index.min.js:1
102
+ #: includes/admin/default-settings.php:255
103
  msgid "Show date"
104
  msgstr ""
105
 
136
 
137
  #: includes/admin/blocks/related-posts/index.js:200
138
  #: includes/admin/blocks/related-posts/index.min.js:1
139
+ #: includes/admin/default-settings.php:405
140
  msgid "Randomize posts"
141
  msgstr ""
142
 
238
  msgstr ""
239
 
240
  #: includes/admin/default-settings.php:111
241
+ msgid "Only from same"
242
  msgstr ""
243
 
244
  #: includes/admin/default-settings.php:112
245
  msgid ""
246
+ "Limit the related posts only to the categories, tags, and/or taxonomies of "
247
+ "the current post."
248
+ msgstr ""
249
+
250
+ #: includes/admin/default-settings.php:118
251
+ msgid "Match all taxonomies"
252
+ msgstr ""
253
+
254
+ #: includes/admin/default-settings.php:119
255
+ msgid ""
256
+ "If enabled, then it will only select posts that match all the above selected "
257
+ "taxonomies. This can result in no related posts being found."
258
+ msgstr ""
259
+
260
+ #: includes/admin/default-settings.php:125
261
+ msgid "Number of common terms"
262
+ msgstr ""
263
+
264
+ #: includes/admin/default-settings.php:126
265
+ msgid ""
266
+ "Enter the minimum number of common terms that have to be matched before a "
267
+ "post is considered related."
268
+ msgstr ""
269
+
270
+ #: includes/admin/default-settings.php:133
271
+ msgid "Disable on mobile devices"
272
+ msgstr ""
273
+
274
+ #: includes/admin/default-settings.php:134
275
+ msgid ""
276
  "Disable display of related posts on mobile devices. Might not always work "
277
  "with caching plugins."
278
  msgstr ""
279
 
280
+ #: includes/admin/default-settings.php:140
281
  msgid "Disable on AMP pages"
282
  msgstr ""
283
 
284
+ #: includes/admin/default-settings.php:141
285
  msgid "Disable display of related posts on AMP pages."
286
  msgstr ""
287
 
288
+ #: includes/admin/default-settings.php:147
289
  msgid "Delete options on uninstall"
290
  msgstr ""
291
 
292
+ #: includes/admin/default-settings.php:148
293
  msgid ""
294
  "If this is checked, all settings related to Contextual Related Posts are "
295
  "removed from the database if you choose to uninstall/delete the plugin."
296
  msgstr ""
297
 
298
+ #: includes/admin/default-settings.php:154
299
  msgid "Delete FULLTEXT indices on uninstall"
300
  msgstr ""
301
 
302
+ #: includes/admin/default-settings.php:155
303
  msgid ""
304
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
305
  "are removed from the database if you choose to uninstall/delete the plugin."
306
  msgstr ""
307
 
308
+ #: includes/admin/default-settings.php:161
309
  msgid "Delete FULLTEXT indices on deactivate"
310
  msgstr ""
311
 
312
+ #: includes/admin/default-settings.php:162
313
  msgid ""
314
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
315
  "are removed from the database if you choose to deactivate the plugin."
316
  msgstr ""
317
 
318
+ #: includes/admin/default-settings.php:168
319
  msgid "Show metabox"
320
  msgstr ""
321
 
322
+ #: includes/admin/default-settings.php:169
323
  msgid ""
324
  "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
325
  "Posts screens. Also applies to Pages and Custom Post Types."
326
  msgstr ""
327
 
328
+ #: includes/admin/default-settings.php:175
329
  msgid "Limit meta box to Admins only"
330
  msgstr ""
331
 
332
+ #: includes/admin/default-settings.php:176
333
  msgid ""
334
  "If selected, the meta box will be hidden from anyone who is not an Admin. By "
335
  "default, Contributors and above will be able to see the meta box. Applies "
336
  "only if the above option is selected."
337
  msgstr ""
338
 
339
+ #: includes/admin/default-settings.php:182
340
  msgid "Link to Contextual Related Posts plugin page"
341
  msgstr ""
342
 
343
+ #: includes/admin/default-settings.php:183
344
  msgid ""
345
  "A no-follow link to the plugin homepage will be added as the last item of "
346
  "the related posts."
347
  msgstr ""
348
 
349
+ #: includes/admin/default-settings.php:212
350
  msgid "Heading of posts"
351
  msgstr ""
352
 
353
+ #: includes/admin/default-settings.php:213
354
  msgid "Displayed before the list of the posts as a master heading"
355
  msgstr ""
356
 
357
+ #: includes/admin/default-settings.php:220
358
  msgid "Show when no posts are found"
359
  msgstr ""
360
 
361
+ #: includes/admin/default-settings.php:226
362
  msgid "Blank output"
363
  msgstr ""
364
 
365
+ #: includes/admin/default-settings.php:227
366
  msgid "Display custom text"
367
  msgstr ""
368
 
369
+ #: includes/admin/default-settings.php:232
370
  msgid "Custom text"
371
  msgstr ""
372
 
373
+ #: includes/admin/default-settings.php:233
374
  msgid ""
375
  "Enter the custom text that will be displayed if the second option is "
376
  "selected above."
377
  msgstr ""
378
 
379
+ #: includes/admin/default-settings.php:235 includes/deprecated.php:149
380
  msgid "No related posts found"
381
  msgstr ""
382
 
383
+ #: includes/admin/default-settings.php:239
384
+ #: includes/admin/default-settings.php:693
385
  msgid "Show post excerpt"
386
  msgstr ""
387
 
388
+ #: includes/admin/default-settings.php:240
389
  msgid ""
390
  "If the post does not have an excerpt, the plugin will automatically create "
391
  "one containing the number of words specified in the next option."
392
  msgstr ""
393
 
394
+ #: includes/admin/default-settings.php:246
395
  msgid "Length of excerpt (in words)"
396
  msgstr ""
397
 
398
+ #: includes/admin/default-settings.php:256
399
  msgid ""
400
  "Displays the date of the post. Uses the same date format set in General "
401
  "Options."
402
  msgstr ""
403
 
404
+ #: includes/admin/default-settings.php:269
405
  msgid "Limit post title length (in characters)"
406
  msgstr ""
407
 
408
+ #: includes/admin/default-settings.php:270
409
  msgid ""
410
  "Any title longer than the number of characters set above will be cut and "
411
  "appended with an ellipsis (&hellip;)"
412
  msgstr ""
413
 
414
+ #: includes/admin/default-settings.php:277
415
  msgid "Open links in new window"
416
  msgstr ""
417
 
418
+ #: includes/admin/default-settings.php:284
419
  msgid "Add nofollow to links"
420
  msgstr ""
421
 
422
+ #: includes/admin/default-settings.php:291
423
  msgid "Exclusion settings"
424
  msgstr ""
425
 
426
+ #: includes/admin/default-settings.php:297
427
  msgid "Exclude display on these posts"
428
  msgstr ""
429
 
430
+ #: includes/admin/default-settings.php:298
431
  msgid ""
432
  "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
433
  msgstr ""
434
 
435
+ #: includes/admin/default-settings.php:304
436
  msgid "Exclude display on these post types"
437
  msgstr ""
438
 
439
+ #: includes/admin/default-settings.php:305
440
  msgid ""
441
  "The related posts will not display on any of the above selected post types."
442
  msgstr ""
443
 
444
+ #: includes/admin/default-settings.php:311
445
+ msgid "Exclude on Categories"
446
+ msgstr ""
447
+
448
+ #: includes/admin/default-settings.php:312
449
+ #: includes/admin/default-settings.php:458
450
+ msgid ""
451
+ "Comma separated list of category slugs. The field above has an autocomplete "
452
+ "so simply start typing in the starting letters and it will prompt you with "
453
+ "options. Does not support custom taxonomies."
454
+ msgstr ""
455
+
456
+ #: includes/admin/default-settings.php:323
457
  msgid "HTML to display"
458
  msgstr ""
459
 
460
+ #: includes/admin/default-settings.php:329
461
  msgid "Before the list of posts"
462
  msgstr ""
463
 
464
+ #: includes/admin/default-settings.php:336
465
  msgid "After the list of posts"
466
  msgstr ""
467
 
468
+ #: includes/admin/default-settings.php:343
469
  msgid "Before each list item"
470
  msgstr ""
471
 
472
+ #: includes/admin/default-settings.php:350
473
  msgid "After each list item"
474
  msgstr ""
475
 
476
+ #: includes/admin/default-settings.php:380
477
+ #: includes/admin/default-settings.php:684
478
  msgid "Number of posts to display"
479
  msgstr ""
480
 
481
+ #: includes/admin/default-settings.php:381
482
  msgid ""
483
  "Maximum number of posts that will be displayed in the list. This option is "
484
  "used if you do not specify the number of posts in the widget or shortcodes"
485
  msgstr ""
486
 
487
+ #: includes/admin/default-settings.php:389
488
  msgid "Related posts should be newer than"
489
  msgstr ""
490
 
491
+ #: includes/admin/default-settings.php:390
492
  msgid ""
493
  "This sets the cut-off period for which posts will be displayed. e.g. setting "
494
  "it to 365 will show related posts from the last year only. Set to 0 to "
495
  "disable limiting posts by date."
496
  msgstr ""
497
 
498
+ #: includes/admin/default-settings.php:397
499
  #: includes/modules/class-crp-widget.php:132
500
  msgid "Order posts"
501
  msgstr ""
502
 
503
+ #: includes/admin/default-settings.php:406
504
  msgid ""
505
  "This shuffles the selected related posts. If you select to order by date in "
506
  "the previous option, then the related posts will first be sorted by date and "
508
  "enabled."
509
  msgstr ""
510
 
511
+ #: includes/admin/default-settings.php:412
512
  msgid "Related posts based on title and content"
513
  msgstr ""
514
 
515
+ #: includes/admin/default-settings.php:413
516
  msgid ""
517
  "If unchecked, only posts titles are used. Enable the cache if enabling this "
518
  "option for better performance. Each site is different, so toggle this option "
519
  "to see which setting gives you better quality related posts."
520
  msgstr ""
521
 
522
+ #: includes/admin/default-settings.php:419
523
  msgid "Limit content to be compared"
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:421
527
  #, php-format
528
  msgid ""
529
  "This sets the maximum words of the content that will be matched. Set to 0 "
530
  "for no limit. Max value: %1$s. Only applies if you activate the above option."
531
  msgstr ""
532
 
533
+ #: includes/admin/default-settings.php:429
534
  #: includes/modules/class-crp-widget.php:156
535
  msgid "Post types to include"
536
  msgstr ""
537
 
538
+ #: includes/admin/default-settings.php:430
539
  msgid ""
540
  "At least one option should be selected above. Select which post types you "
541
  "want to include in the list of posts. This field can be overridden using a "
542
  "comma separated list of post types when using the manual display."
543
  msgstr ""
544
 
545
+ #: includes/admin/default-settings.php:436
546
  msgid "Limit to same post type"
547
  msgstr ""
548
 
549
+ #: includes/admin/default-settings.php:437
550
  msgid ""
551
  "If checked, the related posts will only be selected from the same post type "
552
  "of the current post."
553
  msgstr ""
554
 
555
+ #: includes/admin/default-settings.php:443
556
  msgid "Limit to same author"
557
  msgstr ""
558
 
559
+ #: includes/admin/default-settings.php:444
560
  msgid ""
561
  "If checked, the related posts will only be selected from the same author of "
562
  "the current post."
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:450
566
  msgid "Post/page IDs to exclude"
567
  msgstr ""
568
 
569
+ #: includes/admin/default-settings.php:451
570
  msgid ""
571
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
572
  "188,320,500"
573
  msgstr ""
574
 
575
+ #: includes/admin/default-settings.php:457
576
  msgid "Exclude Categories"
577
  msgstr ""
578
 
579
+ #: includes/admin/default-settings.php:469
 
 
 
 
 
 
 
580
  msgid "Exclude category IDs"
581
  msgstr ""
582
 
583
+ #: includes/admin/default-settings.php:470
584
  msgid ""
585
  "This is a readonly field that is automatically populated based on the above "
586
  "input when the settings are saved. These might differ from the IDs visible "
588
  "the term_taxonomy_id which is unique to this taxonomy."
589
  msgstr ""
590
 
591
+ #: includes/admin/default-settings.php:477
592
+ msgid "Disable contextual matching"
593
+ msgstr ""
594
+
595
+ #: includes/admin/default-settings.php:478
596
+ msgid ""
597
+ "Selecting this option will turn off contextual matching. This is only useful "
598
+ "if you activate the option: \"Only from same\" from the General tab. "
599
+ "Otherwise, you will end up with the same set of related posts on all pages "
600
+ "with no relevance."
601
+ msgstr ""
602
+
603
+ #: includes/admin/default-settings.php:484
604
+ msgid "Disable contextual matching ONLY on attachments and custom post types"
605
+ msgstr ""
606
+
607
+ #: includes/admin/default-settings.php:485
608
+ msgid ""
609
+ "Applies only if the previous option is checked. Selecting this option will "
610
+ "retain contextual matching for posts and pages but disable this on any "
611
+ "custom post types."
612
+ msgstr ""
613
+
614
+ #: includes/admin/default-settings.php:514
615
+ #: includes/admin/default-settings.php:700
616
  msgid "Location of the post thumbnail"
617
  msgstr ""
618
 
619
+ #: includes/admin/default-settings.php:519
620
+ #: includes/admin/default-settings.php:705
621
  msgid "Display thumbnails inline with posts, before title"
622
  msgstr ""
623
 
624
+ #: includes/admin/default-settings.php:520
625
+ #: includes/admin/default-settings.php:706
626
  msgid "Display thumbnails inline with posts, after title"
627
  msgstr ""
628
 
629
+ #: includes/admin/default-settings.php:521
630
+ #: includes/admin/default-settings.php:707
631
  msgid "Display only thumbnails, no text"
632
  msgstr ""
633
 
634
+ #: includes/admin/default-settings.php:522
635
+ #: includes/admin/default-settings.php:708
636
  msgid "Do not display thumbnails, only text"
637
  msgstr ""
638
 
639
+ #: includes/admin/default-settings.php:527
640
  msgid "Thumbnail size"
641
  msgstr ""
642
 
643
+ #: includes/admin/default-settings.php:528
644
  msgid ""
645
  "You can choose from existing image sizes above or create a custom size. If "
646
  "you have chosen Custom size above, then enter the width, height and crop "
648
  "width and/or height below, existing images will not be automatically resized."
649
  msgstr ""
650
 
651
+ #: includes/admin/default-settings.php:530
652
  #, php-format
653
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
654
  msgstr ""
655
 
656
+ #: includes/admin/default-settings.php:540
657
+ #: includes/admin/default-settings.php:713
658
  #: includes/modules/class-crp-widget.php:129
659
  msgid "Thumbnail width"
660
  msgstr ""
661
 
662
+ #: includes/admin/default-settings.php:549
663
+ #: includes/admin/default-settings.php:722
664
  #: includes/modules/class-crp-widget.php:124
665
  msgid "Thumbnail height"
666
  msgstr ""
667
 
668
+ #: includes/admin/default-settings.php:558
669
  msgid "Hard crop thumbnails"
670
  msgstr ""
671
 
672
+ #: includes/admin/default-settings.php:559
673
  msgid ""
674
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
675
  "above vs. maintaining proportions."
676
  msgstr ""
677
 
678
+ #: includes/admin/default-settings.php:565
679
  msgid "Generate thumbnail sizes"
680
  msgstr ""
681
 
682
+ #: includes/admin/default-settings.php:566
683
  msgid ""
684
  "If you select this option and Custom size is selected above, the plugin will "
685
  "register the image size with WordPress to create new thumbnails. Does not "
686
  "update old images as explained above."
687
  msgstr ""
688
 
689
+ #: includes/admin/default-settings.php:572
690
  msgid "Thumbnail size attributes"
691
  msgstr ""
692
 
693
+ #: includes/admin/default-settings.php:578
694
  #, php-format
695
  msgid "Use CSS to set the width and height: e.g. %s"
696
  msgstr ""
697
 
698
+ #: includes/admin/default-settings.php:580
699
  #, php-format
700
  msgid "Use HTML attributes to set the width and height: e.g. %s"
701
  msgstr ""
702
 
703
+ #: includes/admin/default-settings.php:581
704
  msgid ""
705
  "No width or height set. You will need to use external styles to force any "
706
  "width or height of your choice."
707
  msgstr ""
708
 
709
+ #: includes/admin/default-settings.php:586
710
  msgid "Thumbnail meta field name"
711
  msgstr ""
712
 
713
+ #: includes/admin/default-settings.php:587
714
  msgid ""
715
  "The value of this field should contain the URL of the image and can be set "
716
  "in the metabox in the Edit Post screen"
717
  msgstr ""
718
 
719
+ #: includes/admin/default-settings.php:593
720
  msgid "Get first image"
721
  msgstr ""
722
 
723
+ #: includes/admin/default-settings.php:594
724
  msgid ""
725
  "The plugin will fetch the first image in the post content if this is "
726
  "enabled. This can slow down the loading of your page if the first image in "
727
  "the followed posts is large in file-size."
728
  msgstr ""
729
 
730
+ #: includes/admin/default-settings.php:600
731
  msgid "Use default thumbnail?"
732
  msgstr ""
733
 
734
+ #: includes/admin/default-settings.php:601
735
  msgid ""
736
  "If checked, when no thumbnail is found, show a default one from the URL "
737
  "below. If not checked and no thumbnail is found, no image will be shown."
738
  msgstr ""
739
 
740
+ #: includes/admin/default-settings.php:607 includes/admin/settings-page.php:747
741
  msgid "Default thumbnail"
742
  msgstr ""
743
 
744
+ #: includes/admin/default-settings.php:608
745
  msgid ""
746
  "Enter the full URL of the image that you wish to display if no thumbnail is "
747
  "found. This image will be displayed below."
748
  msgstr ""
749
 
750
+ #: includes/admin/default-settings.php:638
751
  msgid "Related Posts style"
752
  msgstr ""
753
 
754
+ #: includes/admin/default-settings.php:646
755
  msgid "Custom CSS"
756
  msgstr ""
757
 
758
+ #: includes/admin/default-settings.php:648
759
  #, php-format
760
  msgid ""
761
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
762
  "CSS classes to style."
763
  msgstr ""
764
 
765
+ #: includes/admin/default-settings.php:678
766
  msgid "About this tab"
767
  msgstr ""
768
 
769
+ #: includes/admin/default-settings.php:679
770
  msgid ""
771
  "Below options override the related posts settings for your blog feed. These "
772
  "only apply if you have selected to add related posts to Feeds in the General "
774
  "way to style the related posts in the feed."
775
  msgstr ""
776
 
777
+ #: includes/admin/default-settings.php:799
778
  msgid "No styles"
779
  msgstr ""
780
 
781
+ #: includes/admin/default-settings.php:800
782
  msgid "Select this option if you plan to add your own styles"
783
  msgstr ""
784
 
785
+ #: includes/admin/default-settings.php:804
786
  msgid "Text only"
787
  msgstr ""
788
 
789
+ #: includes/admin/default-settings.php:805
790
  msgid "Disable thumbnails and no longer include the default style sheet"
791
  msgstr ""
792
 
793
+ #: includes/admin/default-settings.php:809
794
  msgid "Rounded thumbnails"
795
  msgstr ""
796
 
797
+ #: includes/admin/default-settings.php:810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  msgid ""
799
+ "Enabling this option will turn on the thumbnails. It will also turn off the "
800
+ "display of the author, excerpt and date if already enabled. Disabling this "
801
+ "option will not revert any settings."
802
  msgstr ""
803
 
804
+ #: includes/admin/default-settings.php:814
805
+ msgid "Masonry"
 
 
 
806
  msgstr ""
807
 
808
+ #: includes/admin/default-settings.php:815
809
+ msgid "Enables a masonry style layout similar to one made famous by Pinterest."
 
810
  msgstr ""
811
 
812
+ #: includes/admin/default-settings.php:819
813
+ msgid "Grid"
 
 
814
  msgstr ""
815
 
816
+ #: includes/admin/default-settings.php:820
817
+ msgid "Uses CSS Grid for display. Might not work on older browsers."
 
 
818
  msgstr ""
819
 
820
+ #: includes/admin/default-settings.php:824
821
+ msgid "Rounded thumbnails with CSS grid"
822
  msgstr ""
823
 
824
+ #: includes/admin/default-settings.php:825
825
  msgid ""
826
+ "Uses CSS grid. It will also turn off the display of the author, excerpt and "
827
+ "date if already enabled. Disabling this option will not revert any settings."
828
  msgstr ""
829
 
830
+ #: includes/admin/default-settings.php:848
831
+ msgid "By relevance"
 
 
832
  msgstr ""
833
 
834
+ #: includes/admin/default-settings.php:849
835
+ msgid "Randomly"
836
  msgstr ""
837
 
838
+ #: includes/admin/default-settings.php:850
839
+ msgid "By date"
 
 
840
  msgstr ""
841
 
842
+ #: includes/admin/help-tab.php:29
843
+ #, php-format
844
  msgid ""
845
+ "For more information or how to get support visit the <a href=\"%1$s\" target="
846
+ "\"_blank\">WebberZone support site</a>."
 
 
 
 
847
  msgstr ""
848
 
849
+ #: includes/admin/help-tab.php:31
850
+ #, php-format
851
  msgid ""
852
+ "Support queries should be posted in the <a href=\"%1$s\" target=\"_blank"
853
+ "\">WordPress.org support forums</a>."
854
  msgstr ""
855
 
856
+ #: includes/admin/help-tab.php:34
857
+ #, php-format
858
  msgid ""
859
+ "<a href=\"%1$s\" target=\"_blank\">Post an issue</a> on <a href=\"%2$s\" "
860
+ "target=\"_blank\">GitHub</a> (bug reports only)."
 
861
  msgstr ""
862
 
863
+ #: includes/admin/help-tab.php:43 includes/admin/modules/loader.php:29
864
+ msgid "Settings"
865
  msgstr ""
866
 
867
+ #: includes/admin/help-tab.php:45
868
  msgid ""
869
+ "This screen provides the various settings for configuring Contextual Related "
870
+ "Posts."
871
  msgstr ""
872
 
873
+ #: includes/admin/help-tab.php:48
874
+ #, php-format
875
  msgid ""
876
+ "You can find detailed information on each of the settings in these <a href="
877
+ "\"%1$s\" target=\"_blank\">knowledgebase articles</a>."
 
 
 
 
 
 
 
 
 
 
 
 
878
  msgstr ""
879
 
880
+ #: includes/admin/help-tab.php:59
881
  msgid ""
882
  "This screen provides some tools that help maintain certain features of "
883
  "Contextual Related Posts."
884
  msgstr ""
885
 
886
+ #: includes/admin/help-tab.php:60
887
  msgid ""
888
+ "Clear the cache, recreate the fulltext indices (including code to manually "
889
+ "run this in phpMyAdmin), export/import settings and delete the older "
890
+ "settings."
891
  msgstr ""
892
 
893
+ #: includes/admin/help-tab.php:63
894
+ #, php-format
895
  msgid ""
896
+ "You can find more information on each of these tools in this <a href=\"%1$s"
897
+ "\" target=\"_blank\">knowledgebase article</a>."
 
 
 
 
 
 
 
 
898
  msgstr ""
899
 
900
  #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
1072
  "should do this only if you are comfortable with the new settings."
1073
  msgstr ""
1074
 
1075
+ #: includes/admin/modules/tools.php:235
1076
  msgid "Please upload a valid .json file"
1077
  msgstr ""
1078
 
1079
+ #: includes/admin/modules/tools.php:241
1080
  msgid "Please upload a file to import"
1081
  msgstr ""
1082
 
1122
  msgid "Reset all settings"
1123
  msgstr ""
1124
 
1125
+ #: includes/admin/settings-page.php:129
1126
+ msgid "General"
1127
+ msgstr ""
1128
+
1129
  #: includes/admin/settings-page.php:130
1130
  msgid "List tuning"
1131
  msgstr ""
1134
  msgid "Output"
1135
  msgstr ""
1136
 
1137
+ #: includes/admin/settings-page.php:132
1138
+ msgid "Thumbnail"
1139
+ msgstr ""
1140
+
1141
+ #: includes/admin/settings-page.php:133
1142
+ msgid "Styles"
1143
+ msgstr ""
1144
+
1145
  #: includes/admin/settings-page.php:134
1146
  msgid "Feed"
1147
  msgstr ""
1156
  msgid "Modified from default setting"
1157
  msgstr ""
1158
 
1159
+ #: includes/admin/settings-page.php:769
1160
  msgid ""
1161
  "This option cannot be changed because of the selected related posts style. "
1162
  "To modify this option, you will need to select No styles or Text only in the "
1163
  "Styles tab"
1164
  msgstr ""
1165
 
1166
+ #: includes/admin/settings-page.php:773
1167
  msgid ""
1168
  "This option cannot be changed because of the selected related posts style. "
1169
  "To modify this option, you will need to select No styles in the Styles tab"
1217
  msgid "Follow me"
1218
  msgstr ""
1219
 
1220
+ #: includes/main-query.php:209
1221
  #, php-format
1222
  msgid ""
1223
  "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
1284
  msgid " by "
1285
  msgstr ""
1286
 
1287
+ #: includes/tools.php:79
1288
+ #, php-format
1289
+ msgid "Continue reading %s"
1290
+ msgstr ""
1291
+
1292
+ #: includes/tools.php:87
1293
+ msgid "(more&hellip;)"
1294
+ msgstr ""
1295
+
1296
+ #: includes/tools.php:115
1297
  msgid "There is no excerpt because this is a protected post."
1298
  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-06-14 22:38+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: WebberZone\n"
@@ -22,8 +22,8 @@ msgstr ""
22
  msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
- #: includes/admin/admin.php:32 includes/admin/default-settings.php:193
26
- #: includes/deprecated.php:183
27
  msgid "Related Posts"
28
  msgstr ""
29
 
@@ -31,7 +31,7 @@ msgstr ""
31
  msgid "Contextual Related Posts Tools"
32
  msgstr ""
33
 
34
- #: includes/admin/admin.php:42
35
  msgid "Tools"
36
  msgstr ""
37
 
@@ -93,13 +93,13 @@ msgstr ""
93
 
94
  #: includes/admin/blocks/related-posts/index.js:173
95
  #: includes/admin/blocks/related-posts/index.min.js:1
96
- #: includes/admin/default-settings.php:240
97
  msgid "Show author"
98
  msgstr ""
99
 
100
  #: includes/admin/blocks/related-posts/index.js:178
101
  #: includes/admin/blocks/related-posts/index.min.js:1
102
- #: includes/admin/default-settings.php:233
103
  msgid "Show date"
104
  msgstr ""
105
 
@@ -136,7 +136,7 @@ msgstr ""
136
 
137
  #: includes/admin/blocks/related-posts/index.js:200
138
  #: includes/admin/blocks/related-posts/index.min.js:1
139
- #: includes/admin/default-settings.php:371
140
  msgid "Randomize posts"
141
  msgstr ""
142
 
@@ -238,227 +238,269 @@ msgid ""
238
  msgstr ""
239
 
240
  #: includes/admin/default-settings.php:111
241
- msgid "Disable on mobile devices"
242
  msgstr ""
243
 
244
  #: includes/admin/default-settings.php:112
245
  msgid ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  "Disable display of related posts on mobile devices. Might not always work "
247
  "with caching plugins."
248
  msgstr ""
249
 
250
- #: includes/admin/default-settings.php:118
251
  msgid "Disable on AMP pages"
252
  msgstr ""
253
 
254
- #: includes/admin/default-settings.php:119
255
  msgid "Disable display of related posts on AMP pages."
256
  msgstr ""
257
 
258
- #: includes/admin/default-settings.php:125
259
  msgid "Delete options on uninstall"
260
  msgstr ""
261
 
262
- #: includes/admin/default-settings.php:126
263
  msgid ""
264
  "If this is checked, all settings related to Contextual Related Posts are "
265
  "removed from the database if you choose to uninstall/delete the plugin."
266
  msgstr ""
267
 
268
- #: includes/admin/default-settings.php:132
269
  msgid "Delete FULLTEXT indices on uninstall"
270
  msgstr ""
271
 
272
- #: includes/admin/default-settings.php:133
273
  msgid ""
274
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
275
  "are removed from the database if you choose to uninstall/delete the plugin."
276
  msgstr ""
277
 
278
- #: includes/admin/default-settings.php:139
279
  msgid "Delete FULLTEXT indices on deactivate"
280
  msgstr ""
281
 
282
- #: includes/admin/default-settings.php:140
283
  msgid ""
284
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
285
  "are removed from the database if you choose to deactivate the plugin."
286
  msgstr ""
287
 
288
- #: includes/admin/default-settings.php:146
289
  msgid "Show metabox"
290
  msgstr ""
291
 
292
- #: includes/admin/default-settings.php:147
293
  msgid ""
294
  "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
295
  "Posts screens. Also applies to Pages and Custom Post Types."
296
  msgstr ""
297
 
298
- #: includes/admin/default-settings.php:153
299
  msgid "Limit meta box to Admins only"
300
  msgstr ""
301
 
302
- #: includes/admin/default-settings.php:154
303
  msgid ""
304
  "If selected, the meta box will be hidden from anyone who is not an Admin. By "
305
  "default, Contributors and above will be able to see the meta box. Applies "
306
  "only if the above option is selected."
307
  msgstr ""
308
 
309
- #: includes/admin/default-settings.php:160
310
  msgid "Link to Contextual Related Posts plugin page"
311
  msgstr ""
312
 
313
- #: includes/admin/default-settings.php:161
314
  msgid ""
315
  "A no-follow link to the plugin homepage will be added as the last item of "
316
  "the related posts."
317
  msgstr ""
318
 
319
- #: includes/admin/default-settings.php:190
320
  msgid "Heading of posts"
321
  msgstr ""
322
 
323
- #: includes/admin/default-settings.php:191
324
  msgid "Displayed before the list of the posts as a master heading"
325
  msgstr ""
326
 
327
- #: includes/admin/default-settings.php:198
328
  msgid "Show when no posts are found"
329
  msgstr ""
330
 
331
- #: includes/admin/default-settings.php:204
332
  msgid "Blank output"
333
  msgstr ""
334
 
335
- #: includes/admin/default-settings.php:205
336
  msgid "Display custom text"
337
  msgstr ""
338
 
339
- #: includes/admin/default-settings.php:210
340
  msgid "Custom text"
341
  msgstr ""
342
 
343
- #: includes/admin/default-settings.php:211
344
  msgid ""
345
  "Enter the custom text that will be displayed if the second option is "
346
  "selected above."
347
  msgstr ""
348
 
349
- #: includes/admin/default-settings.php:213 includes/deprecated.php:185
350
  msgid "No related posts found"
351
  msgstr ""
352
 
353
- #: includes/admin/default-settings.php:217
354
- #: includes/admin/default-settings.php:645
355
  msgid "Show post excerpt"
356
  msgstr ""
357
 
358
- #: includes/admin/default-settings.php:218
359
  msgid ""
360
  "If the post does not have an excerpt, the plugin will automatically create "
361
  "one containing the number of words specified in the next option."
362
  msgstr ""
363
 
364
- #: includes/admin/default-settings.php:224
365
  msgid "Length of excerpt (in words)"
366
  msgstr ""
367
 
368
- #: includes/admin/default-settings.php:234
369
  msgid ""
370
  "Displays the date of the post. Uses the same date format set in General "
371
  "Options."
372
  msgstr ""
373
 
374
- #: includes/admin/default-settings.php:247
375
  msgid "Limit post title length (in characters)"
376
  msgstr ""
377
 
378
- #: includes/admin/default-settings.php:248
379
  msgid ""
380
  "Any title longer than the number of characters set above will be cut and "
381
  "appended with an ellipsis (&hellip;)"
382
  msgstr ""
383
 
384
- #: includes/admin/default-settings.php:255
385
  msgid "Open links in new window"
386
  msgstr ""
387
 
388
- #: includes/admin/default-settings.php:262
389
  msgid "Add nofollow to links"
390
  msgstr ""
391
 
392
- #: includes/admin/default-settings.php:269
393
  msgid "Exclusion settings"
394
  msgstr ""
395
 
396
- #: includes/admin/default-settings.php:275
397
  msgid "Exclude display on these posts"
398
  msgstr ""
399
 
400
- #: includes/admin/default-settings.php:276
401
  msgid ""
402
  "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
403
  msgstr ""
404
 
405
- #: includes/admin/default-settings.php:282
406
  msgid "Exclude display on these post types"
407
  msgstr ""
408
 
409
- #: includes/admin/default-settings.php:283
410
  msgid ""
411
  "The related posts will not display on any of the above selected post types."
412
  msgstr ""
413
 
414
- #: includes/admin/default-settings.php:289
 
 
 
 
 
 
 
 
 
 
 
 
415
  msgid "HTML to display"
416
  msgstr ""
417
 
418
- #: includes/admin/default-settings.php:295
419
  msgid "Before the list of posts"
420
  msgstr ""
421
 
422
- #: includes/admin/default-settings.php:302
423
  msgid "After the list of posts"
424
  msgstr ""
425
 
426
- #: includes/admin/default-settings.php:309
427
  msgid "Before each list item"
428
  msgstr ""
429
 
430
- #: includes/admin/default-settings.php:316
431
  msgid "After each list item"
432
  msgstr ""
433
 
434
- #: includes/admin/default-settings.php:346
435
- #: includes/admin/default-settings.php:636
436
  msgid "Number of posts to display"
437
  msgstr ""
438
 
439
- #: includes/admin/default-settings.php:347
440
  msgid ""
441
  "Maximum number of posts that will be displayed in the list. This option is "
442
  "used if you do not specify the number of posts in the widget or shortcodes"
443
  msgstr ""
444
 
445
- #: includes/admin/default-settings.php:355
446
  msgid "Related posts should be newer than"
447
  msgstr ""
448
 
449
- #: includes/admin/default-settings.php:356
450
  msgid ""
451
  "This sets the cut-off period for which posts will be displayed. e.g. setting "
452
  "it to 365 will show related posts from the last year only. Set to 0 to "
453
  "disable limiting posts by date."
454
  msgstr ""
455
 
456
- #: includes/admin/default-settings.php:363
457
  #: includes/modules/class-crp-widget.php:132
458
  msgid "Order posts"
459
  msgstr ""
460
 
461
- #: includes/admin/default-settings.php:372
462
  msgid ""
463
  "This shuffles the selected related posts. If you select to order by date in "
464
  "the previous option, then the related posts will first be sorted by date and "
@@ -466,86 +508,79 @@ msgid ""
466
  "enabled."
467
  msgstr ""
468
 
469
- #: includes/admin/default-settings.php:378
470
  msgid "Related posts based on title and content"
471
  msgstr ""
472
 
473
- #: includes/admin/default-settings.php:379
474
  msgid ""
475
  "If unchecked, only posts titles are used. Enable the cache if enabling this "
476
  "option for better performance. Each site is different, so toggle this option "
477
  "to see which setting gives you better quality related posts."
478
  msgstr ""
479
 
480
- #: includes/admin/default-settings.php:385
481
  msgid "Limit content to be compared"
482
  msgstr ""
483
 
484
- #: includes/admin/default-settings.php:387
485
  #, php-format
486
  msgid ""
487
  "This sets the maximum words of the content that will be matched. Set to 0 "
488
  "for no limit. Max value: %1$s. Only applies if you activate the above option."
489
  msgstr ""
490
 
491
- #: includes/admin/default-settings.php:395
492
  #: includes/modules/class-crp-widget.php:156
493
  msgid "Post types to include"
494
  msgstr ""
495
 
496
- #: includes/admin/default-settings.php:396
497
  msgid ""
498
  "At least one option should be selected above. Select which post types you "
499
  "want to include in the list of posts. This field can be overridden using a "
500
  "comma separated list of post types when using the manual display."
501
  msgstr ""
502
 
503
- #: includes/admin/default-settings.php:402
504
  msgid "Limit to same post type"
505
  msgstr ""
506
 
507
- #: includes/admin/default-settings.php:403
508
  msgid ""
509
  "If checked, the related posts will only be selected from the same post type "
510
  "of the current post."
511
  msgstr ""
512
 
513
- #: includes/admin/default-settings.php:409
514
  msgid "Limit to same author"
515
  msgstr ""
516
 
517
- #: includes/admin/default-settings.php:410
518
  msgid ""
519
  "If checked, the related posts will only be selected from the same author of "
520
  "the current post."
521
  msgstr ""
522
 
523
- #: includes/admin/default-settings.php:416
524
  msgid "Post/page IDs to exclude"
525
  msgstr ""
526
 
527
- #: includes/admin/default-settings.php:417
528
  msgid ""
529
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
530
  "188,320,500"
531
  msgstr ""
532
 
533
- #: includes/admin/default-settings.php:423
534
  msgid "Exclude Categories"
535
  msgstr ""
536
 
537
- #: includes/admin/default-settings.php:424
538
- msgid ""
539
- "Comma separated list of category slugs. The field above has an autocomplete "
540
- "so simply start typing in the starting letters and it will prompt you with "
541
- "options. Does not support custom taxonomies."
542
- msgstr ""
543
-
544
- #: includes/admin/default-settings.php:435
545
  msgid "Exclude category IDs"
546
  msgstr ""
547
 
548
- #: includes/admin/default-settings.php:436
549
  msgid ""
550
  "This is a readonly field that is automatically populated based on the above "
551
  "input when the settings are saved. These might differ from the IDs visible "
@@ -553,36 +588,59 @@ msgid ""
553
  "the term_taxonomy_id which is unique to this taxonomy."
554
  msgstr ""
555
 
556
- #: includes/admin/default-settings.php:466
557
- #: includes/admin/default-settings.php:652
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  msgid "Location of the post thumbnail"
559
  msgstr ""
560
 
561
- #: includes/admin/default-settings.php:471
562
- #: includes/admin/default-settings.php:657
563
  msgid "Display thumbnails inline with posts, before title"
564
  msgstr ""
565
 
566
- #: includes/admin/default-settings.php:472
567
- #: includes/admin/default-settings.php:658
568
  msgid "Display thumbnails inline with posts, after title"
569
  msgstr ""
570
 
571
- #: includes/admin/default-settings.php:473
572
- #: includes/admin/default-settings.php:659
573
  msgid "Display only thumbnails, no text"
574
  msgstr ""
575
 
576
- #: includes/admin/default-settings.php:474
577
- #: includes/admin/default-settings.php:660
578
  msgid "Do not display thumbnails, only text"
579
  msgstr ""
580
 
581
- #: includes/admin/default-settings.php:479
582
  msgid "Thumbnail size"
583
  msgstr ""
584
 
585
- #: includes/admin/default-settings.php:480
586
  msgid ""
587
  "You can choose from existing image sizes above or create a custom size. If "
588
  "you have chosen Custom size above, then enter the width, height and crop "
@@ -590,125 +648,125 @@ msgid ""
590
  "width and/or height below, existing images will not be automatically resized."
591
  msgstr ""
592
 
593
- #: includes/admin/default-settings.php:482
594
  #, php-format
595
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
596
  msgstr ""
597
 
598
- #: includes/admin/default-settings.php:492
599
- #: includes/admin/default-settings.php:665
600
  #: includes/modules/class-crp-widget.php:129
601
  msgid "Thumbnail width"
602
  msgstr ""
603
 
604
- #: includes/admin/default-settings.php:501
605
- #: includes/admin/default-settings.php:674
606
  #: includes/modules/class-crp-widget.php:124
607
  msgid "Thumbnail height"
608
  msgstr ""
609
 
610
- #: includes/admin/default-settings.php:510
611
  msgid "Hard crop thumbnails"
612
  msgstr ""
613
 
614
- #: includes/admin/default-settings.php:511
615
  msgid ""
616
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
617
  "above vs. maintaining proportions."
618
  msgstr ""
619
 
620
- #: includes/admin/default-settings.php:517
621
  msgid "Generate thumbnail sizes"
622
  msgstr ""
623
 
624
- #: includes/admin/default-settings.php:518
625
  msgid ""
626
  "If you select this option and Custom size is selected above, the plugin will "
627
  "register the image size with WordPress to create new thumbnails. Does not "
628
  "update old images as explained above."
629
  msgstr ""
630
 
631
- #: includes/admin/default-settings.php:524
632
  msgid "Thumbnail size attributes"
633
  msgstr ""
634
 
635
- #: includes/admin/default-settings.php:530
636
  #, php-format
637
  msgid "Use CSS to set the width and height: e.g. %s"
638
  msgstr ""
639
 
640
- #: includes/admin/default-settings.php:532
641
  #, php-format
642
  msgid "Use HTML attributes to set the width and height: e.g. %s"
643
  msgstr ""
644
 
645
- #: includes/admin/default-settings.php:533
646
  msgid ""
647
  "No width or height set. You will need to use external styles to force any "
648
  "width or height of your choice."
649
  msgstr ""
650
 
651
- #: includes/admin/default-settings.php:538
652
  msgid "Thumbnail meta field name"
653
  msgstr ""
654
 
655
- #: includes/admin/default-settings.php:539
656
  msgid ""
657
  "The value of this field should contain the URL of the image and can be set "
658
  "in the metabox in the Edit Post screen"
659
  msgstr ""
660
 
661
- #: includes/admin/default-settings.php:545
662
  msgid "Get first image"
663
  msgstr ""
664
 
665
- #: includes/admin/default-settings.php:546
666
  msgid ""
667
  "The plugin will fetch the first image in the post content if this is "
668
  "enabled. This can slow down the loading of your page if the first image in "
669
  "the followed posts is large in file-size."
670
  msgstr ""
671
 
672
- #: includes/admin/default-settings.php:552
673
  msgid "Use default thumbnail?"
674
  msgstr ""
675
 
676
- #: includes/admin/default-settings.php:553
677
  msgid ""
678
  "If checked, when no thumbnail is found, show a default one from the URL "
679
  "below. If not checked and no thumbnail is found, no image will be shown."
680
  msgstr ""
681
 
682
- #: includes/admin/default-settings.php:559 includes/admin/settings-page.php:748
683
  msgid "Default thumbnail"
684
  msgstr ""
685
 
686
- #: includes/admin/default-settings.php:560
687
  msgid ""
688
  "Enter the full URL of the image that you wish to display if no thumbnail is "
689
  "found. This image will be displayed below."
690
  msgstr ""
691
 
692
- #: includes/admin/default-settings.php:590
693
  msgid "Related Posts style"
694
  msgstr ""
695
 
696
- #: includes/admin/default-settings.php:598
697
  msgid "Custom CSS"
698
  msgstr ""
699
 
700
- #: includes/admin/default-settings.php:600
701
  #, php-format
702
  msgid ""
703
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
704
  "CSS classes to style."
705
  msgstr ""
706
 
707
- #: includes/admin/default-settings.php:630
708
  msgid "About this tab"
709
  msgstr ""
710
 
711
- #: includes/admin/default-settings.php:631
712
  msgid ""
713
  "Below options override the related posts settings for your blog feed. These "
714
  "only apply if you have selected to add related posts to Feeds in the General "
@@ -716,183 +774,127 @@ msgid ""
716
  "way to style the related posts in the feed."
717
  msgstr ""
718
 
719
- #: includes/admin/default-settings.php:751
720
  msgid "No styles"
721
  msgstr ""
722
 
723
- #: includes/admin/default-settings.php:752
724
  msgid "Select this option if you plan to add your own styles"
725
  msgstr ""
726
 
727
- #: includes/admin/default-settings.php:756
728
  msgid "Text only"
729
  msgstr ""
730
 
731
- #: includes/admin/default-settings.php:757
732
  msgid "Disable thumbnails and no longer include the default style sheet"
733
  msgstr ""
734
 
735
- #: includes/admin/default-settings.php:761
736
  msgid "Rounded thumbnails"
737
  msgstr ""
738
 
739
- #: includes/admin/default-settings.php:762
740
- msgid ""
741
- "Enabling this option will turn on the thumbnails and force their width and "
742
- "height. It will also turn off the display of the author, excerpt and date if "
743
- "already enabled. Disabling this option will not revert any settings."
744
- msgstr ""
745
-
746
- #: includes/admin/default-settings.php:785
747
- msgid "By relevance"
748
- msgstr ""
749
-
750
- #: includes/admin/default-settings.php:786
751
- msgid "Randomly"
752
- msgstr ""
753
-
754
- #: includes/admin/default-settings.php:787
755
- msgid "By date"
756
- msgstr ""
757
-
758
- #: includes/admin/help-tab.php:35 includes/admin/help-tab.php:126
759
- #, php-format
760
- msgid ""
761
- "For more information or how to get support visit the <a href=\"%1$s"
762
- "\">WebberZone support site</a>."
763
- msgstr ""
764
-
765
- #: includes/admin/help-tab.php:37 includes/admin/help-tab.php:128
766
- #, php-format
767
  msgid ""
768
- "Support queries should be posted in the <a href=\"%1$s\">WordPress.org "
769
- "support forums</a>."
 
770
  msgstr ""
771
 
772
- #: includes/admin/help-tab.php:40 includes/admin/help-tab.php:131
773
- #, php-format
774
- msgid ""
775
- "<a href=\"%1$s\">Post an issue</a> on <a href=\"%2$s\">GitHub</a> (bug "
776
- "reports only)."
777
  msgstr ""
778
 
779
- #: includes/admin/help-tab.php:49 includes/admin/help-tab.php:140
780
- #: includes/admin/settings-page.php:129
781
- msgid "General"
782
  msgstr ""
783
 
784
- #: includes/admin/help-tab.php:51
785
- msgid ""
786
- "This screen provides the basic settings for configuring Contextual Related "
787
- "Posts."
788
  msgstr ""
789
 
790
- #: includes/admin/help-tab.php:52
791
- msgid ""
792
- "Enable the trackers and cache, configure basic tracker settings and "
793
- "uninstall settings."
794
  msgstr ""
795
 
796
- #: includes/admin/help-tab.php:59
797
- msgid "Counter/Tracker"
798
  msgstr ""
799
 
800
- #: includes/admin/help-tab.php:61
801
  msgid ""
802
- "This screen provides settings to tweak the display counter and the tracker."
 
803
  msgstr ""
804
 
805
- #: includes/admin/help-tab.php:62
806
- msgid ""
807
- "Choose where to display the counter and customize the text. Select the type "
808
- "of tracker and which user groups to track."
809
  msgstr ""
810
 
811
- #: includes/admin/help-tab.php:69
812
- msgid "Posts list"
813
  msgstr ""
814
 
815
- #: includes/admin/help-tab.php:71
816
- msgid ""
817
- "This screen provides settings to tweak the output of the list of related "
818
- "posts."
819
  msgstr ""
820
 
821
- #: includes/admin/help-tab.php:72
 
822
  msgid ""
823
- "Set the number of posts, which categories or posts to exclude, customize "
824
- "what to display and specific basic HTML markup used to create the posts."
825
- msgstr ""
826
-
827
- #: includes/admin/help-tab.php:79 includes/admin/settings-page.php:132
828
- msgid "Thumbnail"
829
  msgstr ""
830
 
831
- #: includes/admin/help-tab.php:81
 
832
  msgid ""
833
- "This screen provides settings to tweak the thumbnail that can be displayed "
834
- "for each post in the list."
835
  msgstr ""
836
 
837
- #: includes/admin/help-tab.php:82
 
838
  msgid ""
839
- "Set the location and size of the thumbnail. Additionally, you can choose "
840
- "additional sources for the thumbnail i.e. a meta field, first image or a "
841
- "default thumbnail when nothing is available."
842
  msgstr ""
843
 
844
- #: includes/admin/help-tab.php:89 includes/admin/settings-page.php:133
845
- msgid "Styles"
846
  msgstr ""
847
 
848
- #: includes/admin/help-tab.php:91
849
  msgid ""
850
- "This screen provides options to control the look and feel of the related "
851
- "posts list."
852
  msgstr ""
853
 
854
- #: includes/admin/help-tab.php:92
 
855
  msgid ""
856
- "Choose for default set of styles or add your own custom CSS to tweak the "
857
- "display of the posts."
858
- msgstr ""
859
-
860
- #: includes/admin/help-tab.php:99
861
- msgid "Maintenance"
862
- msgstr ""
863
-
864
- #: includes/admin/help-tab.php:101
865
- msgid "This screen provides options to control the maintenance cron."
866
- msgstr ""
867
-
868
- #: includes/admin/help-tab.php:102
869
- msgid "Choose how often to run maintenance and at what time of the day."
870
  msgstr ""
871
 
872
- #: includes/admin/help-tab.php:142
873
  msgid ""
874
  "This screen provides some tools that help maintain certain features of "
875
  "Contextual Related Posts."
876
  msgstr ""
877
 
878
- #: includes/admin/help-tab.php:143
879
  msgid ""
880
- "Clear the cache, reset the related posts tables plus some miscellaneous "
881
- "fixes for older versions of Contextual Related Posts."
 
882
  msgstr ""
883
 
884
- #: includes/admin/modules/cache.php:54
 
885
  msgid ""
886
- "An error occurred clearing the cache. Please contact your site administrator."
887
- "\\n\\nError message:\\n"
888
- msgstr ""
889
-
890
- #: includes/admin/modules/cache.php:63
891
- msgid " cached row(s) cleared"
892
- msgstr ""
893
-
894
- #: includes/admin/modules/loader.php:29
895
- msgid "Settings"
896
  msgstr ""
897
 
898
  #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
@@ -1070,11 +1072,11 @@ msgid ""
1070
  "should do this only if you are comfortable with the new settings."
1071
  msgstr ""
1072
 
1073
- #: includes/admin/modules/tools.php:239
1074
  msgid "Please upload a valid .json file"
1075
  msgstr ""
1076
 
1077
- #: includes/admin/modules/tools.php:245
1078
  msgid "Please upload a file to import"
1079
  msgstr ""
1080
 
@@ -1120,6 +1122,10 @@ msgstr ""
1120
  msgid "Reset all settings"
1121
  msgstr ""
1122
 
 
 
 
 
1123
  #: includes/admin/settings-page.php:130
1124
  msgid "List tuning"
1125
  msgstr ""
@@ -1128,6 +1134,14 @@ msgstr ""
1128
  msgid "Output"
1129
  msgstr ""
1130
 
 
 
 
 
 
 
 
 
1131
  #: includes/admin/settings-page.php:134
1132
  msgid "Feed"
1133
  msgstr ""
@@ -1142,14 +1156,14 @@ msgstr ""
1142
  msgid "Modified from default setting"
1143
  msgstr ""
1144
 
1145
- #: includes/admin/settings-page.php:770
1146
  msgid ""
1147
  "This option cannot be changed because of the selected related posts style. "
1148
  "To modify this option, you will need to select No styles or Text only in the "
1149
  "Styles tab"
1150
  msgstr ""
1151
 
1152
- #: includes/admin/settings-page.php:774
1153
  msgid ""
1154
  "This option cannot be changed because of the selected related posts style. "
1155
  "To modify this option, you will need to select No styles in the Styles tab"
@@ -1203,7 +1217,7 @@ msgstr ""
1203
  msgid "Follow me"
1204
  msgstr ""
1205
 
1206
- #: includes/main-query.php:245
1207
  #, php-format
1208
  msgid ""
1209
  "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
@@ -1270,6 +1284,15 @@ msgstr ""
1270
  msgid " by "
1271
  msgstr ""
1272
 
1273
- #: includes/tools.php:66
 
 
 
 
 
 
 
 
 
1274
  msgid "There is no excerpt because this is a protected post."
1275
  msgstr ""
3
  msgstr ""
4
  "Project-Id-Version: Contextual Related Posts\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2021-01-07 18:05+0000\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: WebberZone\n"
22
  msgid "Contextual Related Posts"
23
  msgstr ""
24
 
25
+ #: includes/admin/admin.php:32 includes/admin/default-settings.php:215
26
+ #: includes/deprecated.php:147
27
  msgid "Related Posts"
28
  msgstr ""
29
 
31
  msgid "Contextual Related Posts Tools"
32
  msgstr ""
33
 
34
+ #: includes/admin/admin.php:42 includes/admin/help-tab.php:57
35
  msgid "Tools"
36
  msgstr ""
37
 
93
 
94
  #: includes/admin/blocks/related-posts/index.js:173
95
  #: includes/admin/blocks/related-posts/index.min.js:1
96
+ #: includes/admin/default-settings.php:262
97
  msgid "Show author"
98
  msgstr ""
99
 
100
  #: includes/admin/blocks/related-posts/index.js:178
101
  #: includes/admin/blocks/related-posts/index.min.js:1
102
+ #: includes/admin/default-settings.php:255
103
  msgid "Show date"
104
  msgstr ""
105
 
136
 
137
  #: includes/admin/blocks/related-posts/index.js:200
138
  #: includes/admin/blocks/related-posts/index.min.js:1
139
+ #: includes/admin/default-settings.php:405
140
  msgid "Randomize posts"
141
  msgstr ""
142
 
238
  msgstr ""
239
 
240
  #: includes/admin/default-settings.php:111
241
+ msgid "Only from same"
242
  msgstr ""
243
 
244
  #: includes/admin/default-settings.php:112
245
  msgid ""
246
+ "Limit the related posts only to the categories, tags, and/or taxonomies of "
247
+ "the current post."
248
+ msgstr ""
249
+
250
+ #: includes/admin/default-settings.php:118
251
+ msgid "Match all taxonomies"
252
+ msgstr ""
253
+
254
+ #: includes/admin/default-settings.php:119
255
+ msgid ""
256
+ "If enabled, then it will only select posts that match all the above selected "
257
+ "taxonomies. This can result in no related posts being found."
258
+ msgstr ""
259
+
260
+ #: includes/admin/default-settings.php:125
261
+ msgid "Number of common terms"
262
+ msgstr ""
263
+
264
+ #: includes/admin/default-settings.php:126
265
+ msgid ""
266
+ "Enter the minimum number of common terms that have to be matched before a "
267
+ "post is considered related."
268
+ msgstr ""
269
+
270
+ #: includes/admin/default-settings.php:133
271
+ msgid "Disable on mobile devices"
272
+ msgstr ""
273
+
274
+ #: includes/admin/default-settings.php:134
275
+ msgid ""
276
  "Disable display of related posts on mobile devices. Might not always work "
277
  "with caching plugins."
278
  msgstr ""
279
 
280
+ #: includes/admin/default-settings.php:140
281
  msgid "Disable on AMP pages"
282
  msgstr ""
283
 
284
+ #: includes/admin/default-settings.php:141
285
  msgid "Disable display of related posts on AMP pages."
286
  msgstr ""
287
 
288
+ #: includes/admin/default-settings.php:147
289
  msgid "Delete options on uninstall"
290
  msgstr ""
291
 
292
+ #: includes/admin/default-settings.php:148
293
  msgid ""
294
  "If this is checked, all settings related to Contextual Related Posts are "
295
  "removed from the database if you choose to uninstall/delete the plugin."
296
  msgstr ""
297
 
298
+ #: includes/admin/default-settings.php:154
299
  msgid "Delete FULLTEXT indices on uninstall"
300
  msgstr ""
301
 
302
+ #: includes/admin/default-settings.php:155
303
  msgid ""
304
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
305
  "are removed from the database if you choose to uninstall/delete the plugin."
306
  msgstr ""
307
 
308
+ #: includes/admin/default-settings.php:161
309
  msgid "Delete FULLTEXT indices on deactivate"
310
  msgstr ""
311
 
312
+ #: includes/admin/default-settings.php:162
313
  msgid ""
314
  "If this is checked, FULLTEXT indices generated by Contextual Related Posts "
315
  "are removed from the database if you choose to deactivate the plugin."
316
  msgstr ""
317
 
318
+ #: includes/admin/default-settings.php:168
319
  msgid "Show metabox"
320
  msgstr ""
321
 
322
+ #: includes/admin/default-settings.php:169
323
  msgid ""
324
  "This will add the Contextual Related Posts metabox on Edit Posts or Add New "
325
  "Posts screens. Also applies to Pages and Custom Post Types."
326
  msgstr ""
327
 
328
+ #: includes/admin/default-settings.php:175
329
  msgid "Limit meta box to Admins only"
330
  msgstr ""
331
 
332
+ #: includes/admin/default-settings.php:176
333
  msgid ""
334
  "If selected, the meta box will be hidden from anyone who is not an Admin. By "
335
  "default, Contributors and above will be able to see the meta box. Applies "
336
  "only if the above option is selected."
337
  msgstr ""
338
 
339
+ #: includes/admin/default-settings.php:182
340
  msgid "Link to Contextual Related Posts plugin page"
341
  msgstr ""
342
 
343
+ #: includes/admin/default-settings.php:183
344
  msgid ""
345
  "A no-follow link to the plugin homepage will be added as the last item of "
346
  "the related posts."
347
  msgstr ""
348
 
349
+ #: includes/admin/default-settings.php:212
350
  msgid "Heading of posts"
351
  msgstr ""
352
 
353
+ #: includes/admin/default-settings.php:213
354
  msgid "Displayed before the list of the posts as a master heading"
355
  msgstr ""
356
 
357
+ #: includes/admin/default-settings.php:220
358
  msgid "Show when no posts are found"
359
  msgstr ""
360
 
361
+ #: includes/admin/default-settings.php:226
362
  msgid "Blank output"
363
  msgstr ""
364
 
365
+ #: includes/admin/default-settings.php:227
366
  msgid "Display custom text"
367
  msgstr ""
368
 
369
+ #: includes/admin/default-settings.php:232
370
  msgid "Custom text"
371
  msgstr ""
372
 
373
+ #: includes/admin/default-settings.php:233
374
  msgid ""
375
  "Enter the custom text that will be displayed if the second option is "
376
  "selected above."
377
  msgstr ""
378
 
379
+ #: includes/admin/default-settings.php:235 includes/deprecated.php:149
380
  msgid "No related posts found"
381
  msgstr ""
382
 
383
+ #: includes/admin/default-settings.php:239
384
+ #: includes/admin/default-settings.php:693
385
  msgid "Show post excerpt"
386
  msgstr ""
387
 
388
+ #: includes/admin/default-settings.php:240
389
  msgid ""
390
  "If the post does not have an excerpt, the plugin will automatically create "
391
  "one containing the number of words specified in the next option."
392
  msgstr ""
393
 
394
+ #: includes/admin/default-settings.php:246
395
  msgid "Length of excerpt (in words)"
396
  msgstr ""
397
 
398
+ #: includes/admin/default-settings.php:256
399
  msgid ""
400
  "Displays the date of the post. Uses the same date format set in General "
401
  "Options."
402
  msgstr ""
403
 
404
+ #: includes/admin/default-settings.php:269
405
  msgid "Limit post title length (in characters)"
406
  msgstr ""
407
 
408
+ #: includes/admin/default-settings.php:270
409
  msgid ""
410
  "Any title longer than the number of characters set above will be cut and "
411
  "appended with an ellipsis (&hellip;)"
412
  msgstr ""
413
 
414
+ #: includes/admin/default-settings.php:277
415
  msgid "Open links in new window"
416
  msgstr ""
417
 
418
+ #: includes/admin/default-settings.php:284
419
  msgid "Add nofollow to links"
420
  msgstr ""
421
 
422
+ #: includes/admin/default-settings.php:291
423
  msgid "Exclusion settings"
424
  msgstr ""
425
 
426
+ #: includes/admin/default-settings.php:297
427
  msgid "Exclude display on these posts"
428
  msgstr ""
429
 
430
+ #: includes/admin/default-settings.php:298
431
  msgid ""
432
  "Comma separated list of post, page or custom post type IDs. e.g. 188,320,500"
433
  msgstr ""
434
 
435
+ #: includes/admin/default-settings.php:304
436
  msgid "Exclude display on these post types"
437
  msgstr ""
438
 
439
+ #: includes/admin/default-settings.php:305
440
  msgid ""
441
  "The related posts will not display on any of the above selected post types."
442
  msgstr ""
443
 
444
+ #: includes/admin/default-settings.php:311
445
+ msgid "Exclude on Categories"
446
+ msgstr ""
447
+
448
+ #: includes/admin/default-settings.php:312
449
+ #: includes/admin/default-settings.php:458
450
+ msgid ""
451
+ "Comma separated list of category slugs. The field above has an autocomplete "
452
+ "so simply start typing in the starting letters and it will prompt you with "
453
+ "options. Does not support custom taxonomies."
454
+ msgstr ""
455
+
456
+ #: includes/admin/default-settings.php:323
457
  msgid "HTML to display"
458
  msgstr ""
459
 
460
+ #: includes/admin/default-settings.php:329
461
  msgid "Before the list of posts"
462
  msgstr ""
463
 
464
+ #: includes/admin/default-settings.php:336
465
  msgid "After the list of posts"
466
  msgstr ""
467
 
468
+ #: includes/admin/default-settings.php:343
469
  msgid "Before each list item"
470
  msgstr ""
471
 
472
+ #: includes/admin/default-settings.php:350
473
  msgid "After each list item"
474
  msgstr ""
475
 
476
+ #: includes/admin/default-settings.php:380
477
+ #: includes/admin/default-settings.php:684
478
  msgid "Number of posts to display"
479
  msgstr ""
480
 
481
+ #: includes/admin/default-settings.php:381
482
  msgid ""
483
  "Maximum number of posts that will be displayed in the list. This option is "
484
  "used if you do not specify the number of posts in the widget or shortcodes"
485
  msgstr ""
486
 
487
+ #: includes/admin/default-settings.php:389
488
  msgid "Related posts should be newer than"
489
  msgstr ""
490
 
491
+ #: includes/admin/default-settings.php:390
492
  msgid ""
493
  "This sets the cut-off period for which posts will be displayed. e.g. setting "
494
  "it to 365 will show related posts from the last year only. Set to 0 to "
495
  "disable limiting posts by date."
496
  msgstr ""
497
 
498
+ #: includes/admin/default-settings.php:397
499
  #: includes/modules/class-crp-widget.php:132
500
  msgid "Order posts"
501
  msgstr ""
502
 
503
+ #: includes/admin/default-settings.php:406
504
  msgid ""
505
  "This shuffles the selected related posts. If you select to order by date in "
506
  "the previous option, then the related posts will first be sorted by date and "
508
  "enabled."
509
  msgstr ""
510
 
511
+ #: includes/admin/default-settings.php:412
512
  msgid "Related posts based on title and content"
513
  msgstr ""
514
 
515
+ #: includes/admin/default-settings.php:413
516
  msgid ""
517
  "If unchecked, only posts titles are used. Enable the cache if enabling this "
518
  "option for better performance. Each site is different, so toggle this option "
519
  "to see which setting gives you better quality related posts."
520
  msgstr ""
521
 
522
+ #: includes/admin/default-settings.php:419
523
  msgid "Limit content to be compared"
524
  msgstr ""
525
 
526
+ #: includes/admin/default-settings.php:421
527
  #, php-format
528
  msgid ""
529
  "This sets the maximum words of the content that will be matched. Set to 0 "
530
  "for no limit. Max value: %1$s. Only applies if you activate the above option."
531
  msgstr ""
532
 
533
+ #: includes/admin/default-settings.php:429
534
  #: includes/modules/class-crp-widget.php:156
535
  msgid "Post types to include"
536
  msgstr ""
537
 
538
+ #: includes/admin/default-settings.php:430
539
  msgid ""
540
  "At least one option should be selected above. Select which post types you "
541
  "want to include in the list of posts. This field can be overridden using a "
542
  "comma separated list of post types when using the manual display."
543
  msgstr ""
544
 
545
+ #: includes/admin/default-settings.php:436
546
  msgid "Limit to same post type"
547
  msgstr ""
548
 
549
+ #: includes/admin/default-settings.php:437
550
  msgid ""
551
  "If checked, the related posts will only be selected from the same post type "
552
  "of the current post."
553
  msgstr ""
554
 
555
+ #: includes/admin/default-settings.php:443
556
  msgid "Limit to same author"
557
  msgstr ""
558
 
559
+ #: includes/admin/default-settings.php:444
560
  msgid ""
561
  "If checked, the related posts will only be selected from the same author of "
562
  "the current post."
563
  msgstr ""
564
 
565
+ #: includes/admin/default-settings.php:450
566
  msgid "Post/page IDs to exclude"
567
  msgstr ""
568
 
569
+ #: includes/admin/default-settings.php:451
570
  msgid ""
571
  "Comma-separated list of post or page IDs to exclude from the list. e.g. "
572
  "188,320,500"
573
  msgstr ""
574
 
575
+ #: includes/admin/default-settings.php:457
576
  msgid "Exclude Categories"
577
  msgstr ""
578
 
579
+ #: includes/admin/default-settings.php:469
 
 
 
 
 
 
 
580
  msgid "Exclude category IDs"
581
  msgstr ""
582
 
583
+ #: includes/admin/default-settings.php:470
584
  msgid ""
585
  "This is a readonly field that is automatically populated based on the above "
586
  "input when the settings are saved. These might differ from the IDs visible "
588
  "the term_taxonomy_id which is unique to this taxonomy."
589
  msgstr ""
590
 
591
+ #: includes/admin/default-settings.php:477
592
+ msgid "Disable contextual matching"
593
+ msgstr ""
594
+
595
+ #: includes/admin/default-settings.php:478
596
+ msgid ""
597
+ "Selecting this option will turn off contextual matching. This is only useful "
598
+ "if you activate the option: \"Only from same\" from the General tab. "
599
+ "Otherwise, you will end up with the same set of related posts on all pages "
600
+ "with no relevance."
601
+ msgstr ""
602
+
603
+ #: includes/admin/default-settings.php:484
604
+ msgid "Disable contextual matching ONLY on attachments and custom post types"
605
+ msgstr ""
606
+
607
+ #: includes/admin/default-settings.php:485
608
+ msgid ""
609
+ "Applies only if the previous option is checked. Selecting this option will "
610
+ "retain contextual matching for posts and pages but disable this on any "
611
+ "custom post types."
612
+ msgstr ""
613
+
614
+ #: includes/admin/default-settings.php:514
615
+ #: includes/admin/default-settings.php:700
616
  msgid "Location of the post thumbnail"
617
  msgstr ""
618
 
619
+ #: includes/admin/default-settings.php:519
620
+ #: includes/admin/default-settings.php:705
621
  msgid "Display thumbnails inline with posts, before title"
622
  msgstr ""
623
 
624
+ #: includes/admin/default-settings.php:520
625
+ #: includes/admin/default-settings.php:706
626
  msgid "Display thumbnails inline with posts, after title"
627
  msgstr ""
628
 
629
+ #: includes/admin/default-settings.php:521
630
+ #: includes/admin/default-settings.php:707
631
  msgid "Display only thumbnails, no text"
632
  msgstr ""
633
 
634
+ #: includes/admin/default-settings.php:522
635
+ #: includes/admin/default-settings.php:708
636
  msgid "Do not display thumbnails, only text"
637
  msgstr ""
638
 
639
+ #: includes/admin/default-settings.php:527
640
  msgid "Thumbnail size"
641
  msgstr ""
642
 
643
+ #: includes/admin/default-settings.php:528
644
  msgid ""
645
  "You can choose from existing image sizes above or create a custom size. If "
646
  "you have chosen Custom size above, then enter the width, height and crop "
648
  "width and/or height below, existing images will not be automatically resized."
649
  msgstr ""
650
 
651
+ #: includes/admin/default-settings.php:530
652
  #, php-format
653
  msgid "I recommend using %1$s or %2$s to regenerate all image sizes."
654
  msgstr ""
655
 
656
+ #: includes/admin/default-settings.php:540
657
+ #: includes/admin/default-settings.php:713
658
  #: includes/modules/class-crp-widget.php:129
659
  msgid "Thumbnail width"
660
  msgstr ""
661
 
662
+ #: includes/admin/default-settings.php:549
663
+ #: includes/admin/default-settings.php:722
664
  #: includes/modules/class-crp-widget.php:124
665
  msgid "Thumbnail height"
666
  msgstr ""
667
 
668
+ #: includes/admin/default-settings.php:558
669
  msgid "Hard crop thumbnails"
670
  msgstr ""
671
 
672
+ #: includes/admin/default-settings.php:559
673
  msgid ""
674
  "Check this box to hard crop the thumbnails. i.e. force the width and height "
675
  "above vs. maintaining proportions."
676
  msgstr ""
677
 
678
+ #: includes/admin/default-settings.php:565
679
  msgid "Generate thumbnail sizes"
680
  msgstr ""
681
 
682
+ #: includes/admin/default-settings.php:566
683
  msgid ""
684
  "If you select this option and Custom size is selected above, the plugin will "
685
  "register the image size with WordPress to create new thumbnails. Does not "
686
  "update old images as explained above."
687
  msgstr ""
688
 
689
+ #: includes/admin/default-settings.php:572
690
  msgid "Thumbnail size attributes"
691
  msgstr ""
692
 
693
+ #: includes/admin/default-settings.php:578
694
  #, php-format
695
  msgid "Use CSS to set the width and height: e.g. %s"
696
  msgstr ""
697
 
698
+ #: includes/admin/default-settings.php:580
699
  #, php-format
700
  msgid "Use HTML attributes to set the width and height: e.g. %s"
701
  msgstr ""
702
 
703
+ #: includes/admin/default-settings.php:581
704
  msgid ""
705
  "No width or height set. You will need to use external styles to force any "
706
  "width or height of your choice."
707
  msgstr ""
708
 
709
+ #: includes/admin/default-settings.php:586
710
  msgid "Thumbnail meta field name"
711
  msgstr ""
712
 
713
+ #: includes/admin/default-settings.php:587
714
  msgid ""
715
  "The value of this field should contain the URL of the image and can be set "
716
  "in the metabox in the Edit Post screen"
717
  msgstr ""
718
 
719
+ #: includes/admin/default-settings.php:593
720
  msgid "Get first image"
721
  msgstr ""
722
 
723
+ #: includes/admin/default-settings.php:594
724
  msgid ""
725
  "The plugin will fetch the first image in the post content if this is "
726
  "enabled. This can slow down the loading of your page if the first image in "
727
  "the followed posts is large in file-size."
728
  msgstr ""
729
 
730
+ #: includes/admin/default-settings.php:600
731
  msgid "Use default thumbnail?"
732
  msgstr ""
733
 
734
+ #: includes/admin/default-settings.php:601
735
  msgid ""
736
  "If checked, when no thumbnail is found, show a default one from the URL "
737
  "below. If not checked and no thumbnail is found, no image will be shown."
738
  msgstr ""
739
 
740
+ #: includes/admin/default-settings.php:607 includes/admin/settings-page.php:747
741
  msgid "Default thumbnail"
742
  msgstr ""
743
 
744
+ #: includes/admin/default-settings.php:608
745
  msgid ""
746
  "Enter the full URL of the image that you wish to display if no thumbnail is "
747
  "found. This image will be displayed below."
748
  msgstr ""
749
 
750
+ #: includes/admin/default-settings.php:638
751
  msgid "Related Posts style"
752
  msgstr ""
753
 
754
+ #: includes/admin/default-settings.php:646
755
  msgid "Custom CSS"
756
  msgstr ""
757
 
758
+ #: includes/admin/default-settings.php:648
759
  #, php-format
760
  msgid ""
761
  "Do not include %3$sstyle%4$s tags. Check out the %1$sFAQ%2$s for available "
762
  "CSS classes to style."
763
  msgstr ""
764
 
765
+ #: includes/admin/default-settings.php:678
766
  msgid "About this tab"
767
  msgstr ""
768
 
769
+ #: includes/admin/default-settings.php:679
770
  msgid ""
771
  "Below options override the related posts settings for your blog feed. These "
772
  "only apply if you have selected to add related posts to Feeds in the General "
774
  "way to style the related posts in the feed."
775
  msgstr ""
776
 
777
+ #: includes/admin/default-settings.php:799
778
  msgid "No styles"
779
  msgstr ""
780
 
781
+ #: includes/admin/default-settings.php:800
782
  msgid "Select this option if you plan to add your own styles"
783
  msgstr ""
784
 
785
+ #: includes/admin/default-settings.php:804
786
  msgid "Text only"
787
  msgstr ""
788
 
789
+ #: includes/admin/default-settings.php:805
790
  msgid "Disable thumbnails and no longer include the default style sheet"
791
  msgstr ""
792
 
793
+ #: includes/admin/default-settings.php:809
794
  msgid "Rounded thumbnails"
795
  msgstr ""
796
 
797
+ #: includes/admin/default-settings.php:810
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
798
  msgid ""
799
+ "Enabling this option will turn on the thumbnails. It will also turn off the "
800
+ "display of the author, excerpt and date if already enabled. Disabling this "
801
+ "option will not revert any settings."
802
  msgstr ""
803
 
804
+ #: includes/admin/default-settings.php:814
805
+ msgid "Masonry"
 
 
 
806
  msgstr ""
807
 
808
+ #: includes/admin/default-settings.php:815
809
+ msgid "Enables a masonry style layout similar to one made famous by Pinterest."
 
810
  msgstr ""
811
 
812
+ #: includes/admin/default-settings.php:819
813
+ msgid "Grid"
 
 
814
  msgstr ""
815
 
816
+ #: includes/admin/default-settings.php:820
817
+ msgid "Uses CSS Grid for display. Might not work on older browsers."
 
 
818
  msgstr ""
819
 
820
+ #: includes/admin/default-settings.php:824
821
+ msgid "Rounded thumbnails with CSS grid"
822
  msgstr ""
823
 
824
+ #: includes/admin/default-settings.php:825
825
  msgid ""
826
+ "Uses CSS grid. It will also turn off the display of the author, excerpt and "
827
+ "date if already enabled. Disabling this option will not revert any settings."
828
  msgstr ""
829
 
830
+ #: includes/admin/default-settings.php:848
831
+ msgid "By relevance"
 
 
832
  msgstr ""
833
 
834
+ #: includes/admin/default-settings.php:849
835
+ msgid "Randomly"
836
  msgstr ""
837
 
838
+ #: includes/admin/default-settings.php:850
839
+ msgid "By date"
 
 
840
  msgstr ""
841
 
842
+ #: includes/admin/help-tab.php:29
843
+ #, php-format
844
  msgid ""
845
+ "For more information or how to get support visit the <a href=\"%1$s\" target="
846
+ "\"_blank\">WebberZone support site</a>."
 
 
 
 
847
  msgstr ""
848
 
849
+ #: includes/admin/help-tab.php:31
850
+ #, php-format
851
  msgid ""
852
+ "Support queries should be posted in the <a href=\"%1$s\" target=\"_blank"
853
+ "\">WordPress.org support forums</a>."
854
  msgstr ""
855
 
856
+ #: includes/admin/help-tab.php:34
857
+ #, php-format
858
  msgid ""
859
+ "<a href=\"%1$s\" target=\"_blank\">Post an issue</a> on <a href=\"%2$s\" "
860
+ "target=\"_blank\">GitHub</a> (bug reports only)."
 
861
  msgstr ""
862
 
863
+ #: includes/admin/help-tab.php:43 includes/admin/modules/loader.php:29
864
+ msgid "Settings"
865
  msgstr ""
866
 
867
+ #: includes/admin/help-tab.php:45
868
  msgid ""
869
+ "This screen provides the various settings for configuring Contextual Related "
870
+ "Posts."
871
  msgstr ""
872
 
873
+ #: includes/admin/help-tab.php:48
874
+ #, php-format
875
  msgid ""
876
+ "You can find detailed information on each of the settings in these <a href="
877
+ "\"%1$s\" target=\"_blank\">knowledgebase articles</a>."
 
 
 
 
 
 
 
 
 
 
 
 
878
  msgstr ""
879
 
880
+ #: includes/admin/help-tab.php:59
881
  msgid ""
882
  "This screen provides some tools that help maintain certain features of "
883
  "Contextual Related Posts."
884
  msgstr ""
885
 
886
+ #: includes/admin/help-tab.php:60
887
  msgid ""
888
+ "Clear the cache, recreate the fulltext indices (including code to manually "
889
+ "run this in phpMyAdmin), export/import settings and delete the older "
890
+ "settings."
891
  msgstr ""
892
 
893
+ #: includes/admin/help-tab.php:63
894
+ #, php-format
895
  msgid ""
896
+ "You can find more information on each of these tools in this <a href=\"%1$s"
897
+ "\" target=\"_blank\">knowledgebase article</a>."
 
 
 
 
 
 
 
 
898
  msgstr ""
899
 
900
  #: includes/admin/modules/loader.php:52 includes/admin/sidebar.php:60
1072
  "should do this only if you are comfortable with the new settings."
1073
  msgstr ""
1074
 
1075
+ #: includes/admin/modules/tools.php:235
1076
  msgid "Please upload a valid .json file"
1077
  msgstr ""
1078
 
1079
+ #: includes/admin/modules/tools.php:241
1080
  msgid "Please upload a file to import"
1081
  msgstr ""
1082
 
1122
  msgid "Reset all settings"
1123
  msgstr ""
1124
 
1125
+ #: includes/admin/settings-page.php:129
1126
+ msgid "General"
1127
+ msgstr ""
1128
+
1129
  #: includes/admin/settings-page.php:130
1130
  msgid "List tuning"
1131
  msgstr ""
1134
  msgid "Output"
1135
  msgstr ""
1136
 
1137
+ #: includes/admin/settings-page.php:132
1138
+ msgid "Thumbnail"
1139
+ msgstr ""
1140
+
1141
+ #: includes/admin/settings-page.php:133
1142
+ msgid "Styles"
1143
+ msgstr ""
1144
+
1145
  #: includes/admin/settings-page.php:134
1146
  msgid "Feed"
1147
  msgstr ""
1156
  msgid "Modified from default setting"
1157
  msgstr ""
1158
 
1159
+ #: includes/admin/settings-page.php:769
1160
  msgid ""
1161
  "This option cannot be changed because of the selected related posts style. "
1162
  "To modify this option, you will need to select No styles or Text only in the "
1163
  "Styles tab"
1164
  msgstr ""
1165
 
1166
+ #: includes/admin/settings-page.php:773
1167
  msgid ""
1168
  "This option cannot be changed because of the selected related posts style. "
1169
  "To modify this option, you will need to select No styles in the Styles tab"
1217
  msgid "Follow me"
1218
  msgstr ""
1219
 
1220
+ #: includes/main-query.php:209
1221
  #, php-format
1222
  msgid ""
1223
  "Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
1284
  msgid " by "
1285
  msgstr ""
1286
 
1287
+ #: includes/tools.php:79
1288
+ #, php-format
1289
+ msgid "Continue reading %s"
1290
+ msgstr ""
1291
+
1292
+ #: includes/tools.php:87
1293
+ msgid "(more&hellip;)"
1294
+ msgstr ""
1295
+
1296
+ #: includes/tools.php:115
1297
  msgid "There is no excerpt because this is a protected post."
1298
  msgstr ""
phpcs.ruleset.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="WordPress Coding Standards for Plugins">
3
+ <description>Generally-applicable sniffs for WordPress plugins</description>
4
+
5
+ <exclude-pattern>*/node_modules/*</exclude-pattern>
6
+ <exclude-pattern>*/vendor/*</exclude-pattern>
7
+ <exclude-pattern>*/tests/*</exclude-pattern>
8
+ <exclude-pattern>*/index.php</exclude-pattern>
9
+
10
+ <rule ref="WordPress" />
11
+
12
+ <!-- Add in some extra rules from other standards. -->
13
+ <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
14
+ <rule ref="Generic.Commenting.Todo"/>
15
+ <rule ref="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
16
+
17
+ </ruleset>
readme.txt CHANGED
@@ -2,8 +2,8 @@
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.4
6
- Requires at least: 4.9
7
  Tested up to: 5.6
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
@@ -48,10 +48,6 @@ On activation, the plugin creates three mySQL FULLTEXT indices (or indexes) that
48
 
49
  You have two sets of options in the settings page which allows you to remove these indices when you deactivate or delete the plugin. The latter is true by default.
50
 
51
- = Extensions/Addons =
52
-
53
- * [Related Posts by Categories and Tags](https://webberzone.com/downloads/crp-taxonomy/)
54
-
55
  = GDPR =
56
  Contextual Related Posts is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. All posts are processed on your site and not sent to any external service.
57
 
@@ -178,62 +174,30 @@ You can insert the related posts anywhere in your post using the `[crp]` shortco
178
 
179
  == Changelog ==
180
 
181
- = 2.9.4 =
182
-
183
- Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-3/](https://webberzone.com/blog/contextual-related-posts-v2-9-3/)
184
-
185
- * Bugs:
186
- * Fixed nonce verification not always done in Import/Export interface. Thanks to [Lenon Leite](https://github.com/lenonleite)
187
-
188
- = 2.9.3 =
189
-
190
- Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-3/](https://webberzone.com/blog/contextual-related-posts-v2-9-3/)
191
-
192
- * Features:
193
- * New constant `CRP_VERSION` to hold the current version of the plugin
194
- * New setting to delete FULLTEXT indices on deactivation
195
-
196
- * Enhancements:
197
- * Added the `$args` attribute to the filters in main-query.php
198
-
199
- = 2.9.2 =
200
-
201
- Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
202
-
203
- Bug fixes:
204
- * Password protected posts will no longer show the excerpt
205
-
206
- = 2.9.1 =
207
-
208
- Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
209
-
210
- Bug fixes:
211
- * Custom CSS box would not save and get cleared out when saving settings
212
- * `include_cat_ids` didn't work with the shortcode
213
-
214
- = 2.9.0 =
215
 
216
- Release post: [https://webberzone.com/blog/contextual-related-posts-v2-9-0/](https://webberzone.com/blog/contextual-related-posts-v2-9-0/)
217
 
218
  * Features:
219
- * New section under Settings > Related Posts > Tools to export and import settings. Best option if you'd like the same configuration across multiple WordPress sites
220
- * New shortcode setting `include_cat_ids` to limit top posts to selected categories/taxonomies. Use a comma separated list of [term_taxonomy_id](https://codex.wordpress.org/WordPress_Taxonomy#wp_term_taxonomy)
221
- * New setting in widget to only include certain categories. Doesn't work with custom taxonomies
222
-
223
- * Enhancements:
224
- * New function: `crp_get_thumb_size()` to get the correct size of the thumbnail
225
- * Only run a get_post query if only the post ID is passed to `crp_get_the_post_thumbnail()`
226
- * `$match_fields` parameter added to `crp_posts_match` filter
227
- * Updated WPML functions to use latest filters
228
- * Admin scripts are no longer loaded into the head - but using a separate JavaScript file
229
- * Implemented CodeMirror to format custom styles box
230
- * New filters `get_crp_short_circuit` and `get_crp_posts_id_short_circuit` to bypass outputs and queries
231
- * `CRP_MAX_WORDS` has been reduced from 500 to 250 to avoid "Too many words" mySQL error
232
- * The link to the Contextual Related Posts link is no longer a list item but a smaller text paragraph below the items. You can turn this on by enabling Show Credit.
233
 
234
  * Bug fixes:
235
- * Fixed errors created when trying to fetch a featured image or scanned images with remote links
236
- * Saving categories fields in the settings page uses `str_getcsv` and a custom function `crp_str_putcsv`
 
 
237
 
238
  = Earlier versions =
239
 
@@ -242,5 +206,5 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
242
 
243
  == Upgrade Notice ==
244
 
245
- = 2.9.4 =
246
- Bug fix and minor security release. 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: 3.0.0
6
+ Requires at least: 5.0
7
  Tested up to: 5.6
8
  Requires PHP: 5.6
9
  License: GPLv2 or later
48
 
49
  You have two sets of options in the settings page which allows you to remove these indices when you deactivate or delete the plugin. The latter is true by default.
50
 
 
 
 
 
51
  = GDPR =
52
  Contextual Related Posts is GDPR compliant as it doesn't collect any personal data about your visitors when installed out of the box. All posts are processed on your site and not sent to any external service.
53
 
174
 
175
  == Changelog ==
176
 
177
+ = 3.0.0 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
 
179
+ Release post: [https://webberzone.com/blog/contextual-related-posts-v3-0-0/](https://webberzone.com/blog/contextual-related-posts-v3-0-0/)
180
 
181
  * Features:
182
+ * New CRP_Query class for fetching related posts. This replaces `get_crp_posts_id()` which will be deprecated in a future version
183
+ * CRP Thumbnails now include the `loading="lazy"` attribute added in WordPress 5.5
184
+ * New parameter `more_link_text` that can be passed to `get_crp()` which holds the "read more". Recommended option to customize the more link text using the filter `crp_excerpt_more_link_text` or the more link element using `crp_excerpt_more_link`
185
+ * Three new styles: "Masonry" (like Pinterest), "Grid" and "Rounded thumbnails with CSS grid". Might not work with older browsers
186
+ * Imported settings of [Related Posts by Categories and Tags](https://webberzone.com/downloads/crp-taxonomy/). That plugin is now deprecated with this release.
187
+
188
+ * Enhancement/Modifications:
189
+ * If WPML or PolyLang are active, `get_crp_posts_id()` and `CRP_Query` will return the translated set of post IDs and external processing is no longer needed
190
+ * Use `wp_img_tag_add_srcset_and_sizes_attr()` to generate srcset and sizes attributes. The original code to display the srcset and sizes attributes will continue to be used
191
+ * Improved caching with inbuilt expiry. Use CRP_CACHE_TIME in your wp-config.php to set how long the cache should be set for. Default is one month
192
+ * CRP_MAX_WORDS has been reduced to 100
193
+ * Dropped the need for FULLTEXT index on post_content which should save some database space
194
+ * Deprecated the following filters: `get_crp_posts_id`, `crp_posts_now_date`, `crp_posts_from_date`, `crp_posts_fields`, `crp_posts_join`, `crp_posts_where`, `crp_posts_groupby`, `crp_posts_having`, `crp_posts_orderby`, `crp_posts_limits`, `get_crp_posts_id_short_circuit`
 
195
 
196
  * Bug fixes:
197
+ * In the settings page, only built-in taxonomies were being incorrectly displayed
198
+ * If "before list item" is empty, then the output was blanked out
199
+ * Settings help has been fixed
200
+ * `crp_get_option` would return an incorrect value if $crp_settings global variable was not set
201
 
202
  = Earlier versions =
203
 
206
 
207
  == Upgrade Notice ==
208
 
209
+ = 3.0.0 =
210
+ Major release. Filters deprecated. Resave settings on upgrade. Please read the release post on https://webberzone.com
uninstall.php CHANGED
@@ -36,8 +36,6 @@ if ( is_multisite() ) {
36
  * Delete plugin data.
37
  *
38
  * @since 2.6.1
39
- *
40
- * @return void
41
  */
42
  function crp_delete_data() {
43
  global $wpdb;
@@ -51,7 +49,8 @@ function crp_delete_data() {
51
  $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
52
  "
53
  DELETE FROM {$wpdb->postmeta}
54
- WHERE meta_key LIKE 'crp_related_posts%'
 
55
  "
56
  );
57
  }
36
  * Delete plugin data.
37
  *
38
  * @since 2.6.1
 
 
39
  */
40
  function crp_delete_data() {
41
  global $wpdb;
49
  $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
50
  "
51
  DELETE FROM {$wpdb->postmeta}
52
+ WHERE `meta_key` LIKE 'crp_related_posts%'
53
+ OR `meta_key` LIKE '_crp_cache_%'
54
  "
55
  );
56
  }