Version Description
Release post: https://webberzone.com/blog/contextual-related-posts-v3-0-0/
- Enhancement/Modifications:
-
include_cat_ids
andexclude_categories
will also accept custom taxonomyterm_taxonomy_id
s - Thumbnail's
img
tag is wrapped in<figure>
- Remove extra checking for
exclude_categories
inget_crp
- Optimise deleting of cache entries when updating a post - post saving should be significantly faster
-
Download this release
Release Info
Developer | Ajay |
Plugin | Contextual Related Posts |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.3 to 3.0.4
- contextual-related-posts.php +1 -1
- includes/class-crp-query.php +7 -9
- includes/main-query.php +1 -18
- includes/modules/cache.php +31 -3
- includes/modules/class-crp-widget.php +221 -219
- includes/output-generator.php +2 -0
- languages/contextual-related-posts-en_US.po +21 -21
- languages/contextual-related-posts-en_US.pot +21 -21
- readme.txt +12 -4
contextual-related-posts.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* Plugin Name: Contextual Related Posts
|
16 |
* Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
|
17 |
* Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
|
18 |
-
* Version: 3.0.
|
19 |
* Author: WebberZone
|
20 |
* Author URI: https://webberzone.com
|
21 |
* License: GPL-2.0+
|
15 |
* Plugin Name: Contextual Related Posts
|
16 |
* Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
|
17 |
* Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
|
18 |
+
* Version: 3.0.4
|
19 |
* Author: WebberZone
|
20 |
* Author URI: https://webberzone.com
|
21 |
* License: GPL-2.0+
|
includes/class-crp-query.php
CHANGED
@@ -60,7 +60,7 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
60 |
public $random_order = false;
|
61 |
|
62 |
/**
|
63 |
-
*
|
64 |
*
|
65 |
* @since 3.0.0
|
66 |
* @var mixed
|
@@ -68,7 +68,7 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
68 |
public $crp_post_meta;
|
69 |
|
70 |
/**
|
71 |
-
*
|
72 |
*
|
73 |
* @since 3.0.0
|
74 |
* @var string
|
@@ -76,7 +76,7 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
76 |
public $match_fields;
|
77 |
|
78 |
/**
|
79 |
-
*
|
80 |
*
|
81 |
* @since 3.0.0
|
82 |
* @var string
|
@@ -131,7 +131,7 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
131 |
* @param string|array $args {
|
132 |
* Optional. Array or string of Query parameters.
|
133 |
*
|
134 |
-
* @type array|string $include_cat_ids An array or comma-separated string of category
|
135 |
* @type array|string $include_post_ids An array or comma-separated string of post IDs.
|
136 |
* @type bool $offset Offset the related posts returned by this number.
|
137 |
* @type int $postid Get related posts for a specific post ID.
|
@@ -212,15 +212,14 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
212 |
|
213 |
if ( ! empty( $args['include_cat_ids'] ) ) {
|
214 |
$tax_query[] = array(
|
215 |
-
'
|
216 |
-
'
|
217 |
-
'
|
218 |
);
|
219 |
}
|
220 |
|
221 |
if ( ! empty( $args['exclude_categories'] ) ) {
|
222 |
$tax_query[] = array(
|
223 |
-
'taxonomy' => 'category',
|
224 |
'field' => 'term_taxonomy_id',
|
225 |
'terms' => wp_parse_id_list( $args['exclude_categories'] ),
|
226 |
'operator' => 'NOT IN',
|
@@ -247,7 +246,6 @@ if ( ! class_exists( 'CRP_Query' ) ) :
|
|
247 |
$term_taxonomy_ids = array_unique( wp_list_pluck( $terms, 'term_taxonomy_id' ) );
|
248 |
|
249 |
$tax_query[] = array(
|
250 |
-
'taxonomy' => 'category',
|
251 |
'field' => 'term_taxonomy_id',
|
252 |
'terms' => wp_parse_id_list( $term_taxonomy_ids ),
|
253 |
'operator' => 'IN',
|
60 |
public $random_order = false;
|
61 |
|
62 |
/**
|
63 |
+
* CRP Post Meta.
|
64 |
*
|
65 |
* @since 3.0.0
|
66 |
* @var mixed
|
68 |
public $crp_post_meta;
|
69 |
|
70 |
/**
|
71 |
+
* Fields to be matched.
|
72 |
*
|
73 |
* @since 3.0.0
|
74 |
* @var string
|
76 |
public $match_fields;
|
77 |
|
78 |
/**
|
79 |
+
* Holds the text to be matched.
|
80 |
*
|
81 |
* @since 3.0.0
|
82 |
* @var string
|
131 |
* @param string|array $args {
|
132 |
* Optional. Array or string of Query parameters.
|
133 |
*
|
134 |
+
* @type array|string $include_cat_ids An array or comma-separated string of category or custom taxonomy term_taxonoy_id.
|
135 |
* @type array|string $include_post_ids An array or comma-separated string of post IDs.
|
136 |
* @type bool $offset Offset the related posts returned by this number.
|
137 |
* @type int $postid Get related posts for a specific post ID.
|
212 |
|
213 |
if ( ! empty( $args['include_cat_ids'] ) ) {
|
214 |
$tax_query[] = array(
|
215 |
+
'field' => 'term_taxonomy_id',
|
216 |
+
'terms' => wp_parse_id_list( $args['include_cat_ids'] ),
|
217 |
+
'include_children' => false,
|
218 |
);
|
219 |
}
|
220 |
|
221 |
if ( ! empty( $args['exclude_categories'] ) ) {
|
222 |
$tax_query[] = array(
|
|
|
223 |
'field' => 'term_taxonomy_id',
|
224 |
'terms' => wp_parse_id_list( $args['exclude_categories'] ),
|
225 |
'operator' => 'NOT IN',
|
246 |
$term_taxonomy_ids = array_unique( wp_list_pluck( $terms, 'term_taxonomy_id' ) );
|
247 |
|
248 |
$tax_query[] = array(
|
|
|
249 |
'field' => 'term_taxonomy_id',
|
250 |
'terms' => wp_parse_id_list( $term_taxonomy_ids ),
|
251 |
'operator' => 'IN',
|
includes/main-query.php
CHANGED
@@ -134,24 +134,7 @@ function get_crp( $args = array() ) {
|
|
134 |
|
135 |
foreach ( $results as $result ) {
|
136 |
|
137 |
-
$result = get_post( $result
|
138 |
-
|
139 |
-
// Process the category exclusion if passed in the shortcode.
|
140 |
-
if ( isset( $exclude_categories ) ) {
|
141 |
-
|
142 |
-
$categorys = get_the_category( $result->ID ); // Fetch categories of the plugin.
|
143 |
-
|
144 |
-
$p_in_c = false; // Variable to check if post exists in a particular category.
|
145 |
-
foreach ( $categorys as $cat ) { // Loop to check if post exists in excluded category.
|
146 |
-
$p_in_c = ( in_array( $cat->cat_ID, $exclude_categories, true ) ) ? true : false;
|
147 |
-
if ( $p_in_c ) {
|
148 |
-
break; // Skip loop execution and go to the next step.
|
149 |
-
}
|
150 |
-
}
|
151 |
-
if ( $p_in_c ) {
|
152 |
-
continue; // Skip loop execution and go to the next step.
|
153 |
-
}
|
154 |
-
}
|
155 |
|
156 |
$output .= crp_before_list_item( $args, $result );
|
157 |
|
134 |
|
135 |
foreach ( $results as $result ) {
|
136 |
|
137 |
+
$result = get_post( $result );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
$output .= crp_before_list_item( $args, $result );
|
140 |
|
includes/modules/cache.php
CHANGED
@@ -51,7 +51,7 @@ function crp_cache_delete( $meta_keys = array() ) {
|
|
51 |
}
|
52 |
|
53 |
foreach ( $meta_keys as $meta_key ) {
|
54 |
-
$del_meta =
|
55 |
if ( $del_meta ) {
|
56 |
$loop++;
|
57 |
}
|
@@ -87,10 +87,12 @@ function crp_cache_get_keys() {
|
|
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(
|
@@ -108,8 +110,13 @@ function crp_cache_get_meta_keys() {
|
|
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' );
|
@@ -152,7 +159,7 @@ function crp_delete_cache_post_save( $post_id ) {
|
|
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 |
}
|
@@ -265,3 +272,24 @@ function delete_crp_cache( $post_id, $key ) {
|
|
265 |
return $result;
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
foreach ( $meta_keys as $meta_key ) {
|
54 |
+
$del_meta = delete_crp_cache_by_key( $meta_key );
|
55 |
if ( $del_meta ) {
|
56 |
$loop++;
|
57 |
}
|
87 |
* Get the _crp_cache keys.
|
88 |
*
|
89 |
* @since 2.7.0
|
90 |
+
* @since 3.0.0 Added $post_id parameter
|
91 |
*
|
92 |
+
* @param int $post_id Post ID. Optional.
|
93 |
* @return array Array of _crp_cache keys.
|
94 |
*/
|
95 |
+
function crp_cache_get_meta_keys( $post_id = 0 ) {
|
96 |
global $wpdb;
|
97 |
|
98 |
$meta_keys = array(
|
110 |
SELECT meta_key
|
111 |
FROM {$wpdb->postmeta}
|
112 |
WHERE `meta_key` LIKE '_crp_cache_%'
|
113 |
+
AND `meta_key` NOT LIKE '_crp_cache_expires_%'
|
114 |
";
|
115 |
|
116 |
+
if ( $post_id > 0 ) {
|
117 |
+
$sql .= $wpdb->prepare( ' AND post_id = %d ', $post_id );
|
118 |
+
}
|
119 |
+
|
120 |
$results = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
|
121 |
|
122 |
$keys = wp_list_pluck( $results, 'meta_key' );
|
159 |
}
|
160 |
|
161 |
// Clear cache of current post.
|
162 |
+
$meta_keys = crp_cache_get_meta_keys( $post_id );
|
163 |
foreach ( $meta_keys as $meta_key ) {
|
164 |
delete_post_meta( $post_id, $meta_key );
|
165 |
}
|
272 |
return $result;
|
273 |
}
|
274 |
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Delete the value of the CRP cache by cache key.
|
278 |
+
*
|
279 |
+
* @since 3.0.4
|
280 |
+
*
|
281 |
+
* @param string $key CRP Cache key.
|
282 |
+
* @return bool True on success, False on failure.
|
283 |
+
*/
|
284 |
+
function delete_crp_cache_by_key( $key ) {
|
285 |
+
$key = str_replace( '_crp_cache_expires_', '', $key );
|
286 |
+
$key = str_replace( '_crp_cache_', '', $key );
|
287 |
+
$meta_key = '_crp_cache_' . $key;
|
288 |
+
$cache_expires = '_crp_cache_expires_' . $key;
|
289 |
+
|
290 |
+
$result = delete_post_meta_by_key( $meta_key );
|
291 |
+
delete_post_meta_by_key( $cache_expires );
|
292 |
+
|
293 |
+
return $result;
|
294 |
+
}
|
295 |
+
|
includes/modules/class-crp-widget.php
CHANGED
@@ -10,72 +10,73 @@ if ( ! defined( 'WPINC' ) ) {
|
|
10 |
die;
|
11 |
}
|
12 |
|
13 |
-
|
14 |
-
* Create a WordPress Widget for CRP.
|
15 |
-
*
|
16 |
-
* @since 1.9
|
17 |
-
*
|
18 |
-
* @extends WP_Widget
|
19 |
-
*/
|
20 |
-
class CRP_Widget extends WP_Widget {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Register widget with WordPress.
|
24 |
-
*/
|
25 |
-
public function __construct() {
|
26 |
-
parent::__construct(
|
27 |
-
'widget_crp',
|
28 |
-
__( 'Related Posts [CRP]', 'contextual-related-posts' ),
|
29 |
-
array(
|
30 |
-
'description' => __( 'Display Related Posts', 'contextual-related-posts' ),
|
31 |
-
'customize_selective_refresh' => true,
|
32 |
-
)
|
33 |
-
);
|
34 |
-
}
|
35 |
-
|
36 |
/**
|
37 |
-
*
|
38 |
*
|
39 |
-
* @
|
40 |
*
|
41 |
-
* @
|
42 |
*/
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
// Parse the Post types.
|
59 |
-
$post_types = array();
|
60 |
-
|
61 |
-
// If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
|
62 |
-
if ( ! empty( $instance['post_types'] ) && false === strpos( $instance['post_types'], '=' ) ) {
|
63 |
-
$post_types = explode( ',', $instance['post_types'] );
|
64 |
-
} elseif ( ! empty( $instance['post_types'] ) ) {
|
65 |
-
parse_str( $instance['post_types'], $post_types ); // Save post types in $post_types variable.
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
<p>
|
80 |
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
81 |
<?php esc_html_e( 'Title', 'contextual-related-posts' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
@@ -162,7 +163,7 @@ class CRP_Widget extends WP_Widget {
|
|
162 |
<?php } ?>
|
163 |
</p>
|
164 |
|
165 |
-
|
166 |
/**
|
167 |
* Fires after Contextual Related Posts widget options.
|
168 |
*
|
@@ -171,187 +172,188 @@ class CRP_Widget extends WP_Widget {
|
|
171 |
* @param array $instance Widget options array
|
172 |
*/
|
173 |
do_action( 'crp_widget_options_after', $instance );
|
174 |
-
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
/**
|
180 |
-
* Sanitize widget form values as they are saved.
|
181 |
-
*
|
182 |
-
* @see WP_Widget::update()
|
183 |
-
*
|
184 |
-
* @param array $new_instance Values just sent to be saved.
|
185 |
-
* @param array $old_instance Previously saved values from database.
|
186 |
-
*
|
187 |
-
* @return array Updated safe values to be saved.
|
188 |
-
*/
|
189 |
-
public function update( $new_instance, $old_instance ) {
|
190 |
-
$instance = $old_instance;
|
191 |
-
$instance = array();
|
192 |
-
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
|
193 |
-
$instance['limit'] = ( ! empty( $new_instance['limit'] ) ) ? intval( $new_instance['limit'] ) : '';
|
194 |
-
$instance['post_thumb_op'] = $new_instance['post_thumb_op'];
|
195 |
-
$instance['thumb_width'] = ( ! empty( $new_instance['thumb_width'] ) ) ? intval( $new_instance['thumb_width'] ) : '';
|
196 |
-
$instance['thumb_height'] = ( ! empty( $new_instance['thumb_height'] ) ) ? intval( $new_instance['thumb_height'] ) : '';
|
197 |
-
$instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? true : false;
|
198 |
-
$instance['show_author'] = isset( $new_instance['show_author'] ) ? true : false;
|
199 |
-
$instance['show_date'] = isset( $new_instance['show_date'] ) ? true : false;
|
200 |
-
$instance['offset'] = ( ! empty( $new_instance['offset'] ) ) ? intval( $new_instance['offset'] ) : '';
|
201 |
-
$instance['ordering'] = isset( $new_instance['ordering'] ) ? $new_instance['ordering'] : '';
|
202 |
-
$instance['random_order'] = isset( $new_instance['random_order'] ) ? true : false;
|
203 |
-
|
204 |
-
// Process post types to be selected.
|
205 |
-
$wp_post_types = get_post_types(
|
206 |
-
array(
|
207 |
-
'public' => true,
|
208 |
-
)
|
209 |
-
);
|
210 |
-
$post_types = isset( $new_instance['post_types'] ) ? $new_instance['post_types'] : array();
|
211 |
-
$post_types = array_intersect( $wp_post_types, $post_types );
|
212 |
-
$instance['post_types'] = implode( ',', $post_types );
|
213 |
-
|
214 |
-
// Save include_categories.
|
215 |
-
$include_categories = array_unique( str_getcsv( $new_instance['include_categories'] ) );
|
216 |
-
|
217 |
-
foreach ( $include_categories as $cat_name ) {
|
218 |
-
$cat = get_term_by( 'name', $cat_name, 'category' );
|
219 |
-
|
220 |
-
if ( isset( $cat->term_taxonomy_id ) ) {
|
221 |
-
$include_cat_ids[] = $cat->term_taxonomy_id;
|
222 |
-
$include_cat_names[] = $cat->name;
|
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 |
|
230 |
/**
|
231 |
-
*
|
|
|
|
|
232 |
*
|
233 |
-
* @
|
|
|
234 |
*
|
235 |
-
* @
|
236 |
-
* @param array $new_instance Values just sent to be saved.
|
237 |
-
* @param array $old_instance Previously saved values from database.
|
238 |
*/
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
*
|
245 |
-
* @see WP_Widget::widget()
|
246 |
-
*
|
247 |
-
* @param array $args Widget arguments.
|
248 |
-
* @param array $instance Saved values from database.
|
249 |
-
*/
|
250 |
-
public function widget( $args, $instance ) {
|
251 |
-
global $post;
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
$crp_post_meta = get_post_meta( $post->ID, 'crp_post_meta', true );
|
256 |
|
257 |
-
|
258 |
-
|
|
|
|
|
259 |
}
|
260 |
-
|
|
|
261 |
|
262 |
-
|
263 |
-
if ( crp_get_option( 'exclude_on_post_types' ) && false === strpos( crp_get_option( 'exclude_on_post_types' ), '=' ) ) {
|
264 |
-
$exclude_on_post_types = explode( ',', crp_get_option( 'exclude_on_post_types' ) );
|
265 |
-
} else {
|
266 |
-
parse_str( crp_get_option( 'exclude_on_post_types' ), $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
|
267 |
-
}
|
268 |
-
|
269 |
-
if ( is_object( $post ) && ( in_array( $post->post_type, $exclude_on_post_types, true ) ) ) {
|
270 |
-
return 0; // Exit without adding related posts.
|
271 |
-
}
|
272 |
-
|
273 |
-
$exclude_on_post_ids = explode( ',', crp_get_option( 'exclude_on_post_ids' ) );
|
274 |
-
|
275 |
-
if ( ( ( is_single() ) && ( ! is_single( $exclude_on_post_ids ) ) ) || ( ( is_page() ) && ( ! is_page( $exclude_on_post_ids ) ) ) ) {
|
276 |
-
|
277 |
-
$title = empty( $instance['title'] ) ? wp_strip_all_tags( str_replace( '%postname%', $post->post_title, crp_get_option( 'title' ) ) ) : $instance['title'];
|
278 |
|
279 |
/**
|
280 |
-
* Filters
|
281 |
*
|
282 |
-
* @since 2.
|
283 |
*
|
284 |
-
* @param
|
285 |
-
* @param array
|
286 |
-
* @param
|
287 |
*/
|
288 |
-
|
|
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
$show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
|
301 |
-
$show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
|
302 |
-
$ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
|
303 |
-
$random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
|
304 |
-
$post_types = isset( $instance['post_types'] ) && ! empty( $instance['post_types'] ) ? $instance['post_types'] : crp_get_option( 'post_types' );
|
305 |
-
$include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
|
306 |
-
|
307 |
-
$arguments = array(
|
308 |
-
'is_widget' => 1,
|
309 |
-
'instance_id' => $this->number,
|
310 |
-
'limit' => $limit,
|
311 |
-
'offset' => $offset,
|
312 |
-
'show_excerpt' => $show_excerpt,
|
313 |
-
'show_author' => $show_author,
|
314 |
-
'show_date' => $show_date,
|
315 |
-
'post_thumb_op' => $post_thumb_op,
|
316 |
-
'thumb_height' => $thumb_height,
|
317 |
-
'thumb_width' => $thumb_width,
|
318 |
-
'ordering' => $ordering,
|
319 |
-
'random_order' => $random_order,
|
320 |
-
'post_types' => $post_types,
|
321 |
-
'include_cat_ids' => $include_cat_ids,
|
322 |
-
);
|
323 |
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
* @since 2.0.0
|
328 |
-
*
|
329 |
-
* @param array $arguments CRP widget options array.
|
330 |
-
* @param array $args Widget arguments.
|
331 |
-
* @param array $instance Saved values from database.
|
332 |
-
* @param mixed $id_base The widget ID.
|
333 |
-
*/
|
334 |
-
$arguments = apply_filters( 'crp_widget_options', $arguments, $args, $instance, $this->id_base );
|
335 |
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
339 |
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
|
348 |
-
/**
|
349 |
-
* Initialise the widget.
|
350 |
-
*
|
351 |
-
* @since 1.9.1
|
352 |
-
*/
|
353 |
-
function register_crp_widget() {
|
354 |
-
register_widget( 'CRP_Widget' );
|
355 |
-
}
|
356 |
-
add_action( 'widgets_init', 'register_crp_widget' );
|
357 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
die;
|
11 |
}
|
12 |
|
13 |
+
if ( ! class_exists( 'CRP_Widget' ) ) :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
+
* Create a WordPress Widget for CRP.
|
16 |
*
|
17 |
+
* @since 1.9
|
18 |
*
|
19 |
+
* @extends WP_Widget
|
20 |
*/
|
21 |
+
class CRP_Widget extends WP_Widget {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Register widget with WordPress.
|
25 |
+
*/
|
26 |
+
public function __construct() {
|
27 |
+
parent::__construct(
|
28 |
+
'widget_crp',
|
29 |
+
__( 'Related Posts [CRP]', 'contextual-related-posts' ),
|
30 |
+
array(
|
31 |
+
'description' => __( 'Display Related Posts', 'contextual-related-posts' ),
|
32 |
+
'customize_selective_refresh' => true,
|
33 |
+
)
|
34 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Back-end widget form.
|
39 |
+
*
|
40 |
+
* @see WP_Widget::form()
|
41 |
+
*
|
42 |
+
* @param array $instance Previously saved values from database.
|
43 |
+
*/
|
44 |
+
public function form( $instance ) {
|
45 |
+
$title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
|
46 |
+
$limit = isset( $instance['limit'] ) ? esc_attr( $instance['limit'] ) : '';
|
47 |
+
$offset = isset( $instance['offset'] ) ? esc_attr( $instance['offset'] ) : '';
|
48 |
+
$show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
|
49 |
+
$show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
|
50 |
+
$show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
|
51 |
+
$post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : '';
|
52 |
+
$thumb_height = isset( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : '';
|
53 |
+
$thumb_width = isset( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : '';
|
54 |
+
$ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
|
55 |
+
$random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
|
56 |
+
$include_categories = isset( $instance['include_categories'] ) ? esc_attr( $instance['include_categories'] ) : '';
|
57 |
+
$include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
|
58 |
+
|
59 |
+
// Parse the Post types.
|
60 |
+
$post_types = array();
|
61 |
+
|
62 |
+
// If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
|
63 |
+
if ( ! empty( $instance['post_types'] ) && false === strpos( $instance['post_types'], '=' ) ) {
|
64 |
+
$post_types = explode( ',', $instance['post_types'] );
|
65 |
+
} elseif ( ! empty( $instance['post_types'] ) ) {
|
66 |
+
parse_str( $instance['post_types'], $post_types ); // Save post types in $post_types variable.
|
67 |
+
}
|
68 |
+
|
69 |
+
$wp_post_types = get_post_types(
|
70 |
+
array(
|
71 |
+
'public' => true,
|
72 |
+
)
|
73 |
+
);
|
74 |
+
$posts_types_inc = array_intersect( $wp_post_types, $post_types );
|
75 |
|
76 |
+
// Get the different ordering settings.
|
77 |
+
$orderings = crp_get_orderings();
|
78 |
|
79 |
+
?>
|
80 |
<p>
|
81 |
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
|
82 |
<?php esc_html_e( 'Title', 'contextual-related-posts' ); ?>: <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
163 |
<?php } ?>
|
164 |
</p>
|
165 |
|
166 |
+
<?php
|
167 |
/**
|
168 |
* Fires after Contextual Related Posts widget options.
|
169 |
*
|
172 |
* @param array $instance Widget options array
|
173 |
*/
|
174 |
do_action( 'crp_widget_options_after', $instance );
|
175 |
+
?>
|
176 |
|
177 |
+
<?php
|
178 |
+
} //ending form creation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
/**
|
181 |
+
* Sanitize widget form values as they are saved.
|
182 |
+
*
|
183 |
+
* @see WP_Widget::update()
|
184 |
*
|
185 |
+
* @param array $new_instance Values just sent to be saved.
|
186 |
+
* @param array $old_instance Previously saved values from database.
|
187 |
*
|
188 |
+
* @return array Updated safe values to be saved.
|
|
|
|
|
189 |
*/
|
190 |
+
public function update( $new_instance, $old_instance ) {
|
191 |
+
$instance = $old_instance;
|
192 |
+
$instance = array();
|
193 |
+
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? wp_strip_all_tags( $new_instance['title'] ) : '';
|
194 |
+
$instance['limit'] = ( ! empty( $new_instance['limit'] ) ) ? intval( $new_instance['limit'] ) : '';
|
195 |
+
$instance['post_thumb_op'] = $new_instance['post_thumb_op'];
|
196 |
+
$instance['thumb_width'] = ( ! empty( $new_instance['thumb_width'] ) ) ? intval( $new_instance['thumb_width'] ) : '';
|
197 |
+
$instance['thumb_height'] = ( ! empty( $new_instance['thumb_height'] ) ) ? intval( $new_instance['thumb_height'] ) : '';
|
198 |
+
$instance['show_excerpt'] = isset( $new_instance['show_excerpt'] ) ? true : false;
|
199 |
+
$instance['show_author'] = isset( $new_instance['show_author'] ) ? true : false;
|
200 |
+
$instance['show_date'] = isset( $new_instance['show_date'] ) ? true : false;
|
201 |
+
$instance['offset'] = ( ! empty( $new_instance['offset'] ) ) ? intval( $new_instance['offset'] ) : '';
|
202 |
+
$instance['ordering'] = isset( $new_instance['ordering'] ) ? $new_instance['ordering'] : '';
|
203 |
+
$instance['random_order'] = isset( $new_instance['random_order'] ) ? true : false;
|
204 |
+
|
205 |
+
// Process post types to be selected.
|
206 |
+
$wp_post_types = get_post_types(
|
207 |
+
array(
|
208 |
+
'public' => true,
|
209 |
+
)
|
210 |
+
);
|
211 |
+
$post_types = isset( $new_instance['post_types'] ) ? $new_instance['post_types'] : array();
|
212 |
+
$post_types = array_intersect( $wp_post_types, $post_types );
|
213 |
+
$instance['post_types'] = implode( ',', $post_types );
|
214 |
|
215 |
+
// Save include_categories.
|
216 |
+
$include_categories = array_unique( str_getcsv( $new_instance['include_categories'] ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
+
foreach ( $include_categories as $cat_name ) {
|
219 |
+
$cat = get_term_by( 'name', $cat_name, 'category' );
|
|
|
220 |
|
221 |
+
if ( isset( $cat->term_taxonomy_id ) ) {
|
222 |
+
$include_cat_ids[] = $cat->term_taxonomy_id;
|
223 |
+
$include_cat_names[] = $cat->name;
|
224 |
+
}
|
225 |
}
|
226 |
+
$instance['include_cat_ids'] = isset( $include_cat_ids ) ? join( ',', $include_cat_ids ) : '';
|
227 |
+
$instance['include_categories'] = isset( $include_cat_names ) ? crp_str_putcsv( $include_cat_names ) : '';
|
228 |
|
229 |
+
delete_post_meta_by_key( 'crp_related_posts_widget' ); // Delete the cache.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
|
231 |
/**
|
232 |
+
* Filters Update widget options array.
|
233 |
*
|
234 |
+
* @since 2.0.0
|
235 |
*
|
236 |
+
* @param array $instance Widget options array
|
237 |
+
* @param array $new_instance Values just sent to be saved.
|
238 |
+
* @param array $old_instance Previously saved values from database.
|
239 |
*/
|
240 |
+
return apply_filters( 'crp_widget_options_update', $instance, $new_instance, $old_instance );
|
241 |
+
} //ending update
|
242 |
|
243 |
+
/**
|
244 |
+
* Front-end display of widget.
|
245 |
+
*
|
246 |
+
* @see WP_Widget::widget()
|
247 |
+
*
|
248 |
+
* @param array $args Widget arguments.
|
249 |
+
* @param array $instance Saved values from database.
|
250 |
+
*/
|
251 |
+
public function widget( $args, $instance ) {
|
252 |
+
global $post;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
+
// Get the post meta.
|
255 |
+
if ( isset( $post ) ) {
|
256 |
+
$crp_post_meta = get_post_meta( $post->ID, 'crp_post_meta', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
+
if ( isset( $crp_post_meta['disable_here'] ) && $crp_post_meta['disable_here'] ) {
|
259 |
+
return;
|
260 |
+
}
|
261 |
+
}
|
262 |
|
263 |
+
// If post_types is empty or contains a query string then use parse_str else consider it comma-separated.
|
264 |
+
if ( crp_get_option( 'exclude_on_post_types' ) && false === strpos( crp_get_option( 'exclude_on_post_types' ), '=' ) ) {
|
265 |
+
$exclude_on_post_types = explode( ',', crp_get_option( 'exclude_on_post_types' ) );
|
266 |
+
} else {
|
267 |
+
parse_str( crp_get_option( 'exclude_on_post_types' ), $exclude_on_post_types ); // Save post types in $exclude_on_post_types variable.
|
268 |
+
}
|
269 |
|
270 |
+
if ( is_object( $post ) && ( in_array( $post->post_type, $exclude_on_post_types, true ) ) ) {
|
271 |
+
return 0; // Exit without adding related posts.
|
272 |
+
}
|
|
|
273 |
|
274 |
+
$exclude_on_post_ids = explode( ',', crp_get_option( 'exclude_on_post_ids' ) );
|
275 |
+
|
276 |
+
if ( ( ( is_single() ) && ( ! is_single( $exclude_on_post_ids ) ) ) || ( ( is_page() ) && ( ! is_page( $exclude_on_post_ids ) ) ) ) {
|
277 |
+
|
278 |
+
$title = empty( $instance['title'] ) ? wp_strip_all_tags( str_replace( '%postname%', $post->post_title, crp_get_option( 'title' ) ) ) : $instance['title'];
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Filters the widget title.
|
282 |
+
*
|
283 |
+
* @since 2.6.0
|
284 |
+
*
|
285 |
+
* @param string $title The widget title. Default 'Pages'.
|
286 |
+
* @param array $instance Array of settings for the current widget.
|
287 |
+
* @param mixed $id_base The widget ID.
|
288 |
+
*/
|
289 |
+
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
290 |
+
|
291 |
+
$limit = isset( $instance['limit'] ) ? $instance['limit'] : crp_get_option( 'limit' );
|
292 |
+
if ( empty( $limit ) ) {
|
293 |
+
$limit = crp_get_option( 'limit' );
|
294 |
+
}
|
295 |
+
$offset = isset( $instance['offset'] ) ? $instance['offset'] : 0;
|
296 |
+
|
297 |
+
$post_thumb_op = isset( $instance['post_thumb_op'] ) ? esc_attr( $instance['post_thumb_op'] ) : 'text_only';
|
298 |
+
$thumb_height = isset( $instance['thumb_height'] ) && ! empty( $instance['thumb_height'] ) ? esc_attr( $instance['thumb_height'] ) : crp_get_option( 'thumb_height' );
|
299 |
+
$thumb_width = isset( $instance['thumb_width'] ) && ! empty( $instance['thumb_width'] ) ? esc_attr( $instance['thumb_width'] ) : crp_get_option( 'thumb_width' );
|
300 |
+
$show_excerpt = isset( $instance['show_excerpt'] ) ? esc_attr( $instance['show_excerpt'] ) : '';
|
301 |
+
$show_author = isset( $instance['show_author'] ) ? esc_attr( $instance['show_author'] ) : '';
|
302 |
+
$show_date = isset( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : '';
|
303 |
+
$ordering = isset( $instance['ordering'] ) ? esc_attr( $instance['ordering'] ) : '';
|
304 |
+
$random_order = isset( $instance['random_order'] ) ? esc_attr( $instance['random_order'] ) : '';
|
305 |
+
$post_types = isset( $instance['post_types'] ) && ! empty( $instance['post_types'] ) ? $instance['post_types'] : crp_get_option( 'post_types' );
|
306 |
+
$include_cat_ids = isset( $instance['include_cat_ids'] ) ? esc_attr( $instance['include_cat_ids'] ) : '';
|
307 |
+
|
308 |
+
$arguments = array(
|
309 |
+
'is_widget' => 1,
|
310 |
+
'instance_id' => $this->number,
|
311 |
+
'limit' => $limit,
|
312 |
+
'offset' => $offset,
|
313 |
+
'show_excerpt' => $show_excerpt,
|
314 |
+
'show_author' => $show_author,
|
315 |
+
'show_date' => $show_date,
|
316 |
+
'post_thumb_op' => $post_thumb_op,
|
317 |
+
'thumb_height' => $thumb_height,
|
318 |
+
'thumb_width' => $thumb_width,
|
319 |
+
'ordering' => $ordering,
|
320 |
+
'random_order' => $random_order,
|
321 |
+
'post_types' => $post_types,
|
322 |
+
'include_cat_ids' => $include_cat_ids,
|
323 |
+
);
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Filters arguments passed to get_crp for the widget.
|
327 |
+
*
|
328 |
+
* @since 2.0.0
|
329 |
+
*
|
330 |
+
* @param array $arguments CRP widget options array.
|
331 |
+
* @param array $args Widget arguments.
|
332 |
+
* @param array $instance Saved values from database.
|
333 |
+
* @param mixed $id_base The widget ID.
|
334 |
+
*/
|
335 |
+
$arguments = apply_filters( 'crp_widget_options', $arguments, $args, $instance, $this->id_base );
|
336 |
+
|
337 |
+
$output = $args['before_widget'];
|
338 |
+
$output .= $args['before_title'] . $title . $args['after_title'];
|
339 |
+
$output .= get_crp( $arguments );
|
340 |
+
|
341 |
+
$output .= $args['after_widget'];
|
342 |
+
|
343 |
+
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
344 |
+
}// End if.
|
345 |
+
} // Ending function widget.
|
346 |
+
}
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
|
349 |
+
/**
|
350 |
+
* Initialise the widget.
|
351 |
+
*
|
352 |
+
* @since 1.9.1
|
353 |
+
*/
|
354 |
+
function register_crp_widget() {
|
355 |
+
register_widget( 'CRP_Widget' );
|
356 |
+
}
|
357 |
+
add_action( 'widgets_init', 'register_crp_widget' );
|
358 |
+
|
359 |
+
endif;
|
includes/output-generator.php
CHANGED
@@ -302,6 +302,7 @@ function crp_list_link( $args, $result ) {
|
|
302 |
}
|
303 |
|
304 |
if ( 'inline' === $args['post_thumb_op'] || 'after' === $args['post_thumb_op'] || 'thumbs_only' === $args['post_thumb_op'] ) {
|
|
|
305 |
$output .= crp_get_the_post_thumbnail(
|
306 |
array(
|
307 |
'postid' => $result,
|
@@ -315,6 +316,7 @@ function crp_list_link( $args, $result ) {
|
|
315 |
'class' => 'crp_thumb',
|
316 |
)
|
317 |
);
|
|
|
318 |
}
|
319 |
|
320 |
if ( 'inline' === $args['post_thumb_op'] || 'text_only' === $args['post_thumb_op'] ) {
|
302 |
}
|
303 |
|
304 |
if ( 'inline' === $args['post_thumb_op'] || 'after' === $args['post_thumb_op'] || 'thumbs_only' === $args['post_thumb_op'] ) {
|
305 |
+
$output .= '<figure>';
|
306 |
$output .= crp_get_the_post_thumbnail(
|
307 |
array(
|
308 |
'postid' => $result,
|
316 |
'class' => 'crp_thumb',
|
317 |
)
|
318 |
);
|
319 |
+
$output .= '</figure>';
|
320 |
}
|
321 |
|
322 |
if ( 'inline' === $args['post_thumb_op'] || 'text_only' === $args['post_thumb_op'] ) {
|
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: 2021-01-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: Ajay D'Souza\n"
|
8 |
"Language-Team: WebberZone\n"
|
@@ -45,7 +45,7 @@ msgstr ""
|
|
45 |
|
46 |
#: includes/admin/blocks/related-posts/index.js:22
|
47 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
48 |
-
#: includes/modules/class-crp-widget.php:
|
49 |
msgid "Related Posts [CRP]"
|
50 |
msgstr ""
|
51 |
|
@@ -76,13 +76,13 @@ msgstr ""
|
|
76 |
|
77 |
#: includes/admin/blocks/related-posts/index.js:146
|
78 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
79 |
-
#: includes/modules/class-crp-widget.php:
|
80 |
msgid "No. of posts"
|
81 |
msgstr ""
|
82 |
|
83 |
#: includes/admin/blocks/related-posts/index.js:157
|
84 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
85 |
-
#: includes/modules/class-crp-widget.php:
|
86 |
msgid "Offset"
|
87 |
msgstr ""
|
88 |
|
@@ -105,7 +105,7 @@ msgstr ""
|
|
105 |
|
106 |
#: includes/admin/blocks/related-posts/index.js:184
|
107 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
108 |
-
#: includes/modules/class-crp-widget.php:
|
109 |
msgid "Thumbnail options"
|
110 |
msgstr ""
|
111 |
|
@@ -496,7 +496,7 @@ msgid ""
|
|
496 |
msgstr ""
|
497 |
|
498 |
#: includes/admin/default-settings.php:397
|
499 |
-
#: includes/modules/class-crp-widget.php:
|
500 |
msgid "Order posts"
|
501 |
msgstr ""
|
502 |
|
@@ -531,7 +531,7 @@ msgid ""
|
|
531 |
msgstr ""
|
532 |
|
533 |
#: includes/admin/default-settings.php:429
|
534 |
-
#: includes/modules/class-crp-widget.php:
|
535 |
msgid "Post types to include"
|
536 |
msgstr ""
|
537 |
|
@@ -655,13 +655,13 @@ msgstr ""
|
|
655 |
|
656 |
#: includes/admin/default-settings.php:540
|
657 |
#: includes/admin/default-settings.php:713
|
658 |
-
#: includes/modules/class-crp-widget.php:
|
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:
|
665 |
msgid "Thumbnail height"
|
666 |
msgstr ""
|
667 |
|
@@ -1217,7 +1217,7 @@ msgstr ""
|
|
1217 |
msgid "Follow me"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
-
#: includes/main-query.php:
|
1221 |
#, php-format
|
1222 |
msgid ""
|
1223 |
"Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
|
@@ -1236,47 +1236,47 @@ msgstr ""
|
|
1236 |
msgid "filter argument has been deprecated"
|
1237 |
msgstr ""
|
1238 |
|
1239 |
-
#: includes/modules/class-crp-widget.php:
|
1240 |
msgid "Display Related Posts"
|
1241 |
msgstr ""
|
1242 |
|
1243 |
-
#: includes/modules/class-crp-widget.php:
|
1244 |
msgid "Title"
|
1245 |
msgstr ""
|
1246 |
|
1247 |
-
#: includes/modules/class-crp-widget.php:
|
1248 |
msgid " Show excerpt?"
|
1249 |
msgstr ""
|
1250 |
|
1251 |
-
#: includes/modules/class-crp-widget.php:
|
1252 |
msgid " Show author?"
|
1253 |
msgstr ""
|
1254 |
|
1255 |
-
#: includes/modules/class-crp-widget.php:
|
1256 |
msgid " Show date?"
|
1257 |
msgstr ""
|
1258 |
|
1259 |
-
#: includes/modules/class-crp-widget.php:
|
1260 |
msgid "Thumbnails inline, before title"
|
1261 |
msgstr ""
|
1262 |
|
1263 |
-
#: includes/modules/class-crp-widget.php:
|
1264 |
msgid "Thumbnails inline, after title"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
-
#: includes/modules/class-crp-widget.php:
|
1268 |
msgid "Only thumbnails, no text"
|
1269 |
msgstr ""
|
1270 |
|
1271 |
-
#: includes/modules/class-crp-widget.php:
|
1272 |
msgid "No thumbnails, only text."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
-
#: includes/modules/class-crp-widget.php:
|
1276 |
msgid " Randomize posts"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
-
#: includes/modules/class-crp-widget.php:
|
1280 |
msgid "Only from categories"
|
1281 |
msgstr ""
|
1282 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Contextual Related Posts\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2021-01-30 13:51+0000\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: Ajay D'Souza\n"
|
8 |
"Language-Team: WebberZone\n"
|
45 |
|
46 |
#: includes/admin/blocks/related-posts/index.js:22
|
47 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
48 |
+
#: includes/modules/class-crp-widget.php:29
|
49 |
msgid "Related Posts [CRP]"
|
50 |
msgstr ""
|
51 |
|
76 |
|
77 |
#: includes/admin/blocks/related-posts/index.js:146
|
78 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
79 |
+
#: includes/modules/class-crp-widget.php:87
|
80 |
msgid "No. of posts"
|
81 |
msgstr ""
|
82 |
|
83 |
#: includes/admin/blocks/related-posts/index.js:157
|
84 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
85 |
+
#: includes/modules/class-crp-widget.php:92
|
86 |
msgid "Offset"
|
87 |
msgstr ""
|
88 |
|
105 |
|
106 |
#: includes/admin/blocks/related-posts/index.js:184
|
107 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
108 |
+
#: includes/modules/class-crp-widget.php:111
|
109 |
msgid "Thumbnail options"
|
110 |
msgstr ""
|
111 |
|
496 |
msgstr ""
|
497 |
|
498 |
#: includes/admin/default-settings.php:397
|
499 |
+
#: includes/modules/class-crp-widget.php:129
|
500 |
msgid "Order posts"
|
501 |
msgstr ""
|
502 |
|
531 |
msgstr ""
|
532 |
|
533 |
#: includes/admin/default-settings.php:429
|
534 |
+
#: includes/modules/class-crp-widget.php:153
|
535 |
msgid "Post types to include"
|
536 |
msgstr ""
|
537 |
|
655 |
|
656 |
#: includes/admin/default-settings.php:540
|
657 |
#: includes/admin/default-settings.php:713
|
658 |
+
#: includes/modules/class-crp-widget.php:126
|
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:121
|
665 |
msgid "Thumbnail height"
|
666 |
msgstr ""
|
667 |
|
1217 |
msgid "Follow me"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
+
#: includes/main-query.php:188
|
1221 |
#, php-format
|
1222 |
msgid ""
|
1223 |
"Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
|
1236 |
msgid "filter argument has been deprecated"
|
1237 |
msgstr ""
|
1238 |
|
1239 |
+
#: includes/modules/class-crp-widget.php:31
|
1240 |
msgid "Display Related Posts"
|
1241 |
msgstr ""
|
1242 |
|
1243 |
+
#: includes/modules/class-crp-widget.php:82
|
1244 |
msgid "Title"
|
1245 |
msgstr ""
|
1246 |
|
1247 |
+
#: includes/modules/class-crp-widget.php:97
|
1248 |
msgid " Show excerpt?"
|
1249 |
msgstr ""
|
1250 |
|
1251 |
+
#: includes/modules/class-crp-widget.php:102
|
1252 |
msgid " Show author?"
|
1253 |
msgstr ""
|
1254 |
|
1255 |
+
#: includes/modules/class-crp-widget.php:107
|
1256 |
msgid " Show date?"
|
1257 |
msgstr ""
|
1258 |
|
1259 |
+
#: includes/modules/class-crp-widget.php:113
|
1260 |
msgid "Thumbnails inline, before title"
|
1261 |
msgstr ""
|
1262 |
|
1263 |
+
#: includes/modules/class-crp-widget.php:114
|
1264 |
msgid "Thumbnails inline, after title"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
+
#: includes/modules/class-crp-widget.php:115
|
1268 |
msgid "Only thumbnails, no text"
|
1269 |
msgstr ""
|
1270 |
|
1271 |
+
#: includes/modules/class-crp-widget.php:116
|
1272 |
msgid "No thumbnails, only text."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
+
#: includes/modules/class-crp-widget.php:143
|
1276 |
msgid " Randomize posts"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
+
#: includes/modules/class-crp-widget.php:148
|
1280 |
msgid "Only from categories"
|
1281 |
msgstr ""
|
1282 |
|
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: 2021-01-
|
7 |
"PO-Revision-Date: \n"
|
8 |
"Last-Translator: Ajay D'Souza\n"
|
9 |
"Language-Team: WebberZone\n"
|
@@ -45,7 +45,7 @@ msgstr ""
|
|
45 |
|
46 |
#: includes/admin/blocks/related-posts/index.js:22
|
47 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
48 |
-
#: includes/modules/class-crp-widget.php:
|
49 |
msgid "Related Posts [CRP]"
|
50 |
msgstr ""
|
51 |
|
@@ -76,13 +76,13 @@ msgstr ""
|
|
76 |
|
77 |
#: includes/admin/blocks/related-posts/index.js:146
|
78 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
79 |
-
#: includes/modules/class-crp-widget.php:
|
80 |
msgid "No. of posts"
|
81 |
msgstr ""
|
82 |
|
83 |
#: includes/admin/blocks/related-posts/index.js:157
|
84 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
85 |
-
#: includes/modules/class-crp-widget.php:
|
86 |
msgid "Offset"
|
87 |
msgstr ""
|
88 |
|
@@ -105,7 +105,7 @@ msgstr ""
|
|
105 |
|
106 |
#: includes/admin/blocks/related-posts/index.js:184
|
107 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
108 |
-
#: includes/modules/class-crp-widget.php:
|
109 |
msgid "Thumbnail options"
|
110 |
msgstr ""
|
111 |
|
@@ -496,7 +496,7 @@ msgid ""
|
|
496 |
msgstr ""
|
497 |
|
498 |
#: includes/admin/default-settings.php:397
|
499 |
-
#: includes/modules/class-crp-widget.php:
|
500 |
msgid "Order posts"
|
501 |
msgstr ""
|
502 |
|
@@ -531,7 +531,7 @@ msgid ""
|
|
531 |
msgstr ""
|
532 |
|
533 |
#: includes/admin/default-settings.php:429
|
534 |
-
#: includes/modules/class-crp-widget.php:
|
535 |
msgid "Post types to include"
|
536 |
msgstr ""
|
537 |
|
@@ -655,13 +655,13 @@ msgstr ""
|
|
655 |
|
656 |
#: includes/admin/default-settings.php:540
|
657 |
#: includes/admin/default-settings.php:713
|
658 |
-
#: includes/modules/class-crp-widget.php:
|
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:
|
665 |
msgid "Thumbnail height"
|
666 |
msgstr ""
|
667 |
|
@@ -1217,7 +1217,7 @@ msgstr ""
|
|
1217 |
msgid "Follow me"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
-
#: includes/main-query.php:
|
1221 |
#, php-format
|
1222 |
msgid ""
|
1223 |
"Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
|
@@ -1236,47 +1236,47 @@ msgstr ""
|
|
1236 |
msgid "filter argument has been deprecated"
|
1237 |
msgstr ""
|
1238 |
|
1239 |
-
#: includes/modules/class-crp-widget.php:
|
1240 |
msgid "Display Related Posts"
|
1241 |
msgstr ""
|
1242 |
|
1243 |
-
#: includes/modules/class-crp-widget.php:
|
1244 |
msgid "Title"
|
1245 |
msgstr ""
|
1246 |
|
1247 |
-
#: includes/modules/class-crp-widget.php:
|
1248 |
msgid " Show excerpt?"
|
1249 |
msgstr ""
|
1250 |
|
1251 |
-
#: includes/modules/class-crp-widget.php:
|
1252 |
msgid " Show author?"
|
1253 |
msgstr ""
|
1254 |
|
1255 |
-
#: includes/modules/class-crp-widget.php:
|
1256 |
msgid " Show date?"
|
1257 |
msgstr ""
|
1258 |
|
1259 |
-
#: includes/modules/class-crp-widget.php:
|
1260 |
msgid "Thumbnails inline, before title"
|
1261 |
msgstr ""
|
1262 |
|
1263 |
-
#: includes/modules/class-crp-widget.php:
|
1264 |
msgid "Thumbnails inline, after title"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
-
#: includes/modules/class-crp-widget.php:
|
1268 |
msgid "Only thumbnails, no text"
|
1269 |
msgstr ""
|
1270 |
|
1271 |
-
#: includes/modules/class-crp-widget.php:
|
1272 |
msgid "No thumbnails, only text."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
-
#: includes/modules/class-crp-widget.php:
|
1276 |
msgid " Randomize posts"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
-
#: includes/modules/class-crp-widget.php:
|
1280 |
msgid "Only from categories"
|
1281 |
msgstr ""
|
1282 |
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Contextual Related Posts\n"
|
5 |
"Report-Msgid-Bugs-To: \n"
|
6 |
+
"POT-Creation-Date: 2021-01-30 13:51+0000\n"
|
7 |
"PO-Revision-Date: \n"
|
8 |
"Last-Translator: Ajay D'Souza\n"
|
9 |
"Language-Team: WebberZone\n"
|
45 |
|
46 |
#: includes/admin/blocks/related-posts/index.js:22
|
47 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
48 |
+
#: includes/modules/class-crp-widget.php:29
|
49 |
msgid "Related Posts [CRP]"
|
50 |
msgstr ""
|
51 |
|
76 |
|
77 |
#: includes/admin/blocks/related-posts/index.js:146
|
78 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
79 |
+
#: includes/modules/class-crp-widget.php:87
|
80 |
msgid "No. of posts"
|
81 |
msgstr ""
|
82 |
|
83 |
#: includes/admin/blocks/related-posts/index.js:157
|
84 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
85 |
+
#: includes/modules/class-crp-widget.php:92
|
86 |
msgid "Offset"
|
87 |
msgstr ""
|
88 |
|
105 |
|
106 |
#: includes/admin/blocks/related-posts/index.js:184
|
107 |
#: includes/admin/blocks/related-posts/index.min.js:1
|
108 |
+
#: includes/modules/class-crp-widget.php:111
|
109 |
msgid "Thumbnail options"
|
110 |
msgstr ""
|
111 |
|
496 |
msgstr ""
|
497 |
|
498 |
#: includes/admin/default-settings.php:397
|
499 |
+
#: includes/modules/class-crp-widget.php:129
|
500 |
msgid "Order posts"
|
501 |
msgstr ""
|
502 |
|
531 |
msgstr ""
|
532 |
|
533 |
#: includes/admin/default-settings.php:429
|
534 |
+
#: includes/modules/class-crp-widget.php:153
|
535 |
msgid "Post types to include"
|
536 |
msgstr ""
|
537 |
|
655 |
|
656 |
#: includes/admin/default-settings.php:540
|
657 |
#: includes/admin/default-settings.php:713
|
658 |
+
#: includes/modules/class-crp-widget.php:126
|
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:121
|
665 |
msgid "Thumbnail height"
|
666 |
msgstr ""
|
667 |
|
1217 |
msgid "Follow me"
|
1218 |
msgstr ""
|
1219 |
|
1220 |
+
#: includes/main-query.php:188
|
1221 |
#, php-format
|
1222 |
msgid ""
|
1223 |
"Powered by <a href=\"%s\" rel=\"nofollow\" style=\"float:none\">Contextual "
|
1236 |
msgid "filter argument has been deprecated"
|
1237 |
msgstr ""
|
1238 |
|
1239 |
+
#: includes/modules/class-crp-widget.php:31
|
1240 |
msgid "Display Related Posts"
|
1241 |
msgstr ""
|
1242 |
|
1243 |
+
#: includes/modules/class-crp-widget.php:82
|
1244 |
msgid "Title"
|
1245 |
msgstr ""
|
1246 |
|
1247 |
+
#: includes/modules/class-crp-widget.php:97
|
1248 |
msgid " Show excerpt?"
|
1249 |
msgstr ""
|
1250 |
|
1251 |
+
#: includes/modules/class-crp-widget.php:102
|
1252 |
msgid " Show author?"
|
1253 |
msgstr ""
|
1254 |
|
1255 |
+
#: includes/modules/class-crp-widget.php:107
|
1256 |
msgid " Show date?"
|
1257 |
msgstr ""
|
1258 |
|
1259 |
+
#: includes/modules/class-crp-widget.php:113
|
1260 |
msgid "Thumbnails inline, before title"
|
1261 |
msgstr ""
|
1262 |
|
1263 |
+
#: includes/modules/class-crp-widget.php:114
|
1264 |
msgid "Thumbnails inline, after title"
|
1265 |
msgstr ""
|
1266 |
|
1267 |
+
#: includes/modules/class-crp-widget.php:115
|
1268 |
msgid "Only thumbnails, no text"
|
1269 |
msgstr ""
|
1270 |
|
1271 |
+
#: includes/modules/class-crp-widget.php:116
|
1272 |
msgid "No thumbnails, only text."
|
1273 |
msgstr ""
|
1274 |
|
1275 |
+
#: includes/modules/class-crp-widget.php:143
|
1276 |
msgid " Randomize posts"
|
1277 |
msgstr ""
|
1278 |
|
1279 |
+
#: includes/modules/class-crp-widget.php:148
|
1280 |
msgid "Only from categories"
|
1281 |
msgstr ""
|
1282 |
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: related posts, related, related articles, contextual related posts, similar posts, related posts widget
|
3 |
Contributors: webberzone, Ajay
|
4 |
Donate link: https://ajaydsouza.com/donate/
|
5 |
-
Stable tag: 3.0.
|
6 |
Requires at least: 5.0
|
7 |
Tested up to: 5.6
|
8 |
Requires PHP: 5.6
|
@@ -174,10 +174,18 @@ You can insert the related posts anywhere in your post using the `[crp]` shortco
|
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
-
= 3.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 |
* Enhancement/Modifications:
|
182 |
* Grid style minimum width is now decided by the width of the thumbnail and long words are wrapped
|
183 |
|
@@ -227,5 +235,5 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
|
|
227 |
|
228 |
== Upgrade Notice ==
|
229 |
|
230 |
-
= 3.0.
|
231 |
-
|
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.4
|
6 |
Requires at least: 5.0
|
7 |
Tested up to: 5.6
|
8 |
Requires PHP: 5.6
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 3.0.4 =
|
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 |
+
* Enhancement/Modifications:
|
182 |
+
* `include_cat_ids` and `exclude_categories` will also accept custom taxonomy `term_taxonomy_id`s
|
183 |
+
* Thumbnail's `img` tag is wrapped in `<figure>`
|
184 |
+
* Remove extra checking for `exclude_categories` in `get_crp`
|
185 |
+
* Optimise deleting of cache entries when updating a post - post saving should be significantly faster
|
186 |
+
|
187 |
+
= 3.0.3 =
|
188 |
+
|
189 |
* Enhancement/Modifications:
|
190 |
* Grid style minimum width is now decided by the width of the thumbnail and long words are wrapped
|
191 |
|
235 |
|
236 |
== Upgrade Notice ==
|
237 |
|
238 |
+
= 3.0.4 =
|
239 |
+
Bug fixes. Please read the release post on https://webberzone.com
|