Version Description
Release post: https://webberzone.com/blog/contextual-related-posts-v3-2-0/
-
Enhancements/modifications:
- If thumbnail is set as
text only
, then the style is also set astext only
at runtime
- If thumbnail is set as
-
Bug fix:
- PHP error thrown when using
get_crp_posts_id()
- PHP error thrown when using
-
Deprecated:
-
get_crp_posts_id()
. Useget_crp_posts()
instead
-
Download this release
Release Info
Developer | Ajay |
Plugin | Contextual Related Posts |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.2.0 to 3.2.1
- contextual-related-posts.php +2 -2
- includes/header.php +18 -15
- includes/main-query.php +7 -3
- readme.txt +14 -3
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.2.
|
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', '3.2.
|
42 |
}
|
43 |
|
44 |
|
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.2.1
|
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.2.1' );
|
42 |
}
|
43 |
|
44 |
|
includes/header.php
CHANGED
@@ -68,20 +68,22 @@ add_action( 'wp_enqueue_scripts', 'crp_heading_styles' );
|
|
68 |
*
|
69 |
* @since 3.0.0
|
70 |
*
|
|
|
|
|
71 |
* @return array Contains two elements:
|
72 |
* 'name' holding style name and 'extra_css' to be added inline.
|
73 |
*/
|
74 |
-
function crp_get_style() {
|
75 |
|
76 |
-
$
|
77 |
$thumb_width = crp_get_option( 'thumb_width' );
|
78 |
$thumb_height = crp_get_option( 'thumb_height' );
|
79 |
-
$crp_style = crp_get_option( 'crp_styles' );
|
80 |
|
81 |
switch ( $crp_style ) {
|
82 |
case 'rounded_thumbs':
|
83 |
-
$
|
84 |
-
$
|
85 |
.crp_related a {
|
86 |
width: {$thumb_width}px;
|
87 |
height: {$thumb_height}px;
|
@@ -98,13 +100,14 @@ function crp_get_style() {
|
|
98 |
break;
|
99 |
|
100 |
case 'masonry':
|
101 |
-
|
102 |
-
$
|
|
|
103 |
break;
|
104 |
|
105 |
case 'grid':
|
106 |
-
$
|
107 |
-
$
|
108 |
.crp_related ul {
|
109 |
grid-template-columns: repeat(auto-fill, minmax({$thumb_width}px, 1fr));
|
110 |
}
|
@@ -114,8 +117,8 @@ function crp_get_style() {
|
|
114 |
case 'thumbs_grid':
|
115 |
$row_height = max( 0, $thumb_height - 50 );
|
116 |
|
117 |
-
$
|
118 |
-
$
|
119 |
.crp_related ul li a.crp_link {
|
120 |
grid-template-rows: {$row_height}px 50px;
|
121 |
}
|
@@ -126,8 +129,8 @@ function crp_get_style() {
|
|
126 |
break;
|
127 |
|
128 |
default:
|
129 |
-
$
|
130 |
-
$
|
131 |
break;
|
132 |
}
|
133 |
|
@@ -136,10 +139,10 @@ function crp_get_style() {
|
|
136 |
*
|
137 |
* @since 3.2.0
|
138 |
*
|
139 |
-
* @param array $
|
140 |
* @param string $crp_style Style name.
|
141 |
* @param int $thumb_width Thumbnail width.
|
142 |
* @param int $thumb_height Thumbnail height.
|
143 |
*/
|
144 |
-
return apply_filters( 'crp_get_style', $
|
145 |
}
|
68 |
*
|
69 |
* @since 3.0.0
|
70 |
*
|
71 |
+
* @param string $style Style parameter.
|
72 |
+
*
|
73 |
* @return array Contains two elements:
|
74 |
* 'name' holding style name and 'extra_css' to be added inline.
|
75 |
*/
|
76 |
+
function crp_get_style( $style = '' ) {
|
77 |
|
78 |
+
$style_array = array();
|
79 |
$thumb_width = crp_get_option( 'thumb_width' );
|
80 |
$thumb_height = crp_get_option( 'thumb_height' );
|
81 |
+
$crp_style = $style ? $style : crp_get_option( 'crp_styles' );
|
82 |
|
83 |
switch ( $crp_style ) {
|
84 |
case 'rounded_thumbs':
|
85 |
+
$style_array['name'] = 'rounded-thumbs';
|
86 |
+
$style_array['extra_css'] = "
|
87 |
.crp_related a {
|
88 |
width: {$thumb_width}px;
|
89 |
height: {$thumb_height}px;
|
100 |
break;
|
101 |
|
102 |
case 'masonry':
|
103 |
+
case 'text_only':
|
104 |
+
$style_array['name'] = str_replace( '_', '-', $style );
|
105 |
+
$style_array['extra_css'] = '';
|
106 |
break;
|
107 |
|
108 |
case 'grid':
|
109 |
+
$style_array['name'] = 'grid';
|
110 |
+
$style_array['extra_css'] = "
|
111 |
.crp_related ul {
|
112 |
grid-template-columns: repeat(auto-fill, minmax({$thumb_width}px, 1fr));
|
113 |
}
|
117 |
case 'thumbs_grid':
|
118 |
$row_height = max( 0, $thumb_height - 50 );
|
119 |
|
120 |
+
$style_array['name'] = 'thumbs-grid';
|
121 |
+
$style_array['extra_css'] = "
|
122 |
.crp_related ul li a.crp_link {
|
123 |
grid-template-rows: {$row_height}px 50px;
|
124 |
}
|
129 |
break;
|
130 |
|
131 |
default:
|
132 |
+
$style_array['name'] = '';
|
133 |
+
$style_array['extra_css'] = '';
|
134 |
break;
|
135 |
}
|
136 |
|
139 |
*
|
140 |
* @since 3.2.0
|
141 |
*
|
142 |
+
* @param array $style_array Style array containing name and extra_css.
|
143 |
* @param string $crp_style Style name.
|
144 |
* @param int $thumb_width Thumbnail width.
|
145 |
* @param int $thumb_height Thumbnail height.
|
146 |
*/
|
147 |
+
return apply_filters( 'crp_get_style', $style_array, $crp_style, $thumb_width, $thumb_height );
|
148 |
}
|
includes/main-query.php
CHANGED
@@ -108,7 +108,8 @@ function get_crp( $args = array() ) {
|
|
108 |
return $custom_template;
|
109 |
}
|
110 |
|
111 |
-
$
|
|
|
112 |
$post_classes = array(
|
113 |
'main' => 'crp_related',
|
114 |
'widget' => $args['is_widget'] ? 'crp_related_widget' : '',
|
@@ -236,6 +237,7 @@ function get_crp( $args = array() ) {
|
|
236 |
* Fetch related posts IDs.
|
237 |
*
|
238 |
* @since 1.9
|
|
|
239 |
*
|
240 |
* @param array $args Arguments array.
|
241 |
* @return object $results Array of related post objects
|
@@ -243,6 +245,8 @@ function get_crp( $args = array() ) {
|
|
243 |
function get_crp_posts_id( $args = array() ) {
|
244 |
global $wpdb, $post, $crp_settings;
|
245 |
|
|
|
|
|
246 |
$crp_settings = crp_get_settings();
|
247 |
|
248 |
// Initialise some variables.
|
@@ -367,7 +371,7 @@ function get_crp_posts_id( $args = array() ) {
|
|
367 |
if ( is_int( $source_post->ID ) ) {
|
368 |
|
369 |
// Fields to return.
|
370 |
-
$fields = " $wpdb->posts
|
371 |
|
372 |
// Set order by in case of date.
|
373 |
if ( isset( $args['ordering'] ) && 'date' === $args['ordering'] ) {
|
@@ -425,7 +429,7 @@ function get_crp_posts_id( $args = array() ) {
|
|
425 |
$exclude_post_ids = explode( ',', $args['exclude_post_ids'] );
|
426 |
|
427 |
/** This filter has been documented in class-crp-query.php */
|
428 |
-
$exclude_post_ids = apply_filters( 'crp_exclude_post_ids', $exclude_post_ids, $args );
|
429 |
|
430 |
// Convert it back to string.
|
431 |
$exclude_post_ids = implode( ',', array_filter( array_filter( $exclude_post_ids, 'absint' ) ) );
|
108 |
return $custom_template;
|
109 |
}
|
110 |
|
111 |
+
$style = ( 'text_only' === $args['post_thumb_op'] ) ? 'text_only' : $args['crp_styles'];
|
112 |
+
$style_array = crp_get_style( $style );
|
113 |
$post_classes = array(
|
114 |
'main' => 'crp_related',
|
115 |
'widget' => $args['is_widget'] ? 'crp_related_widget' : '',
|
237 |
* Fetch related posts IDs.
|
238 |
*
|
239 |
* @since 1.9
|
240 |
+
* @deprecated 3.2.0
|
241 |
*
|
242 |
* @param array $args Arguments array.
|
243 |
* @return object $results Array of related post objects
|
245 |
function get_crp_posts_id( $args = array() ) {
|
246 |
global $wpdb, $post, $crp_settings;
|
247 |
|
248 |
+
_deprecated_function( __FUNCTION__, '3.2.0', 'get_crp_posts' );
|
249 |
+
|
250 |
$crp_settings = crp_get_settings();
|
251 |
|
252 |
// Initialise some variables.
|
371 |
if ( is_int( $source_post->ID ) ) {
|
372 |
|
373 |
// Fields to return.
|
374 |
+
$fields = " $wpdb->posts.* ";
|
375 |
|
376 |
// Set order by in case of date.
|
377 |
if ( isset( $args['ordering'] ) && 'date' === $args['ordering'] ) {
|
429 |
$exclude_post_ids = explode( ',', $args['exclude_post_ids'] );
|
430 |
|
431 |
/** This filter has been documented in class-crp-query.php */
|
432 |
+
$exclude_post_ids = apply_filters( 'crp_exclude_post_ids', $exclude_post_ids, $args, $source_post );
|
433 |
|
434 |
// Convert it back to string.
|
435 |
$exclude_post_ids = implode( ',', array_filter( array_filter( $exclude_post_ids, 'absint' ) ) );
|
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.2.
|
6 |
Requires at least: 5.6
|
7 |
Tested up to: 5.9
|
8 |
Requires PHP: 7.1
|
@@ -163,10 +163,21 @@ You can insert the related posts anywhere in your post using the `[crp]` shortco
|
|
163 |
|
164 |
== Changelog ==
|
165 |
|
166 |
-
= 3.2.
|
167 |
|
168 |
Release post: [https://webberzone.com/blog/contextual-related-posts-v3-2-0/](https://webberzone.com/blog/contextual-related-posts-v3-2-0/)
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
* New feature:
|
171 |
* New option to limit posts to the primary category/term. The plugin checks if either Yoast, Rank Math, The SEO Framework or SEOPress are active. If none of these are active, the plugin will pick the first category provided by `get_the_terms()`
|
172 |
* New option to show the primary category/term
|
@@ -221,5 +232,5 @@ For the changelog of earlier versions, please refer to the separate changelog.tx
|
|
221 |
|
222 |
== Upgrade Notice ==
|
223 |
|
224 |
-
= 3.2.
|
225 |
New featuers and enhancements. Please read 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.2.1
|
6 |
Requires at least: 5.6
|
7 |
Tested up to: 5.9
|
8 |
Requires PHP: 7.1
|
163 |
|
164 |
== Changelog ==
|
165 |
|
166 |
+
= 3.2.1 =
|
167 |
|
168 |
Release post: [https://webberzone.com/blog/contextual-related-posts-v3-2-0/](https://webberzone.com/blog/contextual-related-posts-v3-2-0/)
|
169 |
|
170 |
+
* Enhancements/modifications:
|
171 |
+
* If thumbnail is set as `text only`, then the style is also set as `text only` at runtime
|
172 |
+
|
173 |
+
* Bug fix:
|
174 |
+
* PHP error thrown when using `get_crp_posts_id()`
|
175 |
+
|
176 |
+
* Deprecated:
|
177 |
+
* `get_crp_posts_id()`. Use `get_crp_posts()` instead
|
178 |
+
|
179 |
+
= 3.2.0 =
|
180 |
+
|
181 |
* New feature:
|
182 |
* New option to limit posts to the primary category/term. The plugin checks if either Yoast, Rank Math, The SEO Framework or SEOPress are active. If none of these are active, the plugin will pick the first category provided by `get_the_terms()`
|
183 |
* New option to show the primary category/term
|
232 |
|
233 |
== Upgrade Notice ==
|
234 |
|
235 |
+
= 3.2.1 =
|
236 |
New featuers and enhancements. Please read the release post on https://webberzone.com
|