Version Description
- 17/11/2019 fix - exclude current post when post grid display on single post/custom post types
Download this release
Release Info
Developer | pickplugins |
Plugin | Post Grid |
Version | 2.0.43 |
Comparing to | |
See all releases |
Code changes from version 2.0.42 to 2.0.43
- post-grid.php +2 -2
- readme.txt +4 -1
- templates/query.php +6 -221
post-grid.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Post Grid by PickPlugins
|
4 |
Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
|
5 |
Description: Awesome post grid for query post from any post type and display on grid.
|
6 |
-
Version: 2.0.
|
7 |
Author: PickPlugins
|
8 |
Author URI: https://www.pickplugins.com/
|
9 |
License: GPLv2 or later
|
@@ -26,7 +26,7 @@ if( !class_exists( 'PostGrid' )){
|
|
26 |
define('post_grid_pro_url', 'https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/');
|
27 |
define('post_grid_qa_url', 'https://www.pickplugins.com/forum/');
|
28 |
define('post_grid_plugin_name', 'Post Grid');
|
29 |
-
define('post_grid_version', '2.0.
|
30 |
|
31 |
|
32 |
include('includes/classes/class-post-grid-support.php');
|
3 |
Plugin Name: Post Grid by PickPlugins
|
4 |
Plugin URI: https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/
|
5 |
Description: Awesome post grid for query post from any post type and display on grid.
|
6 |
+
Version: 2.0.43
|
7 |
Author: PickPlugins
|
8 |
Author URI: https://www.pickplugins.com/
|
9 |
License: GPLv2 or later
|
26 |
define('post_grid_pro_url', 'https://www.pickplugins.com/item/post-grid-create-awesome-grid-from-any-post-type-for-wordpress/');
|
27 |
define('post_grid_qa_url', 'https://www.pickplugins.com/forum/');
|
28 |
define('post_grid_plugin_name', 'Post Grid');
|
29 |
+
define('post_grid_version', '2.0.43');
|
30 |
|
31 |
|
32 |
include('includes/classes/class-post-grid-support.php');
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.3
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -139,6 +139,9 @@ then paste this shortcode anywhere in your page to display grid<br />
|
|
139 |
|
140 |
== Changelog ==
|
141 |
|
|
|
|
|
|
|
142 |
= 2.0.42 =
|
143 |
* 15/11/2019 fix - broken html issue when no post found
|
144 |
|
4 |
Tags: post grid, grid, custom post grid, post type grid, grid display, category filter, custom post, filter, filtering, grid, layout, list, masonry, post, post filter, post layout, taxonomy, taxonomy filter,
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 5.3
|
7 |
+
Stable tag: 2.0.43
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
139 |
|
140 |
== Changelog ==
|
141 |
|
142 |
+
= 2.0.43 =
|
143 |
+
* 17/11/2019 fix - exclude current post when post grid display on single post/custom post types
|
144 |
+
|
145 |
= 2.0.42 =
|
146 |
* 15/11/2019 fix - broken html issue when no post found
|
147 |
|
templates/query.php
CHANGED
@@ -1,9 +1,4 @@
|
|
1 |
<?php
|
2 |
-
/*
|
3 |
-
* @Author pickplugins
|
4 |
-
* Copyright: 2015 pickplugins.com
|
5 |
-
*/
|
6 |
-
|
7 |
if ( ! defined('ABSPATH')) exit; // if direct access
|
8 |
|
9 |
|
@@ -12,142 +7,10 @@ global $wp_query;
|
|
12 |
|
13 |
$default_query_args = array();
|
14 |
|
15 |
-
$ignore_sticky_posts = (int) $ignore_sticky_posts;
|
16 |
-
|
17 |
-
|
18 |
-
/* ################################ Sticky Post query ######################################*/
|
19 |
-
|
20 |
-
if($sticky_post_query_type=='include'){
|
21 |
-
|
22 |
-
$default_query_args['post__in'] = get_option( 'sticky_posts' );
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
elseif($sticky_post_query_type=='exclude'){
|
27 |
-
|
28 |
-
if(!empty($exclude_post_id)){
|
29 |
-
$exclude_post_id = array_merge(get_option( 'sticky_posts' ), $exclude_post_id);
|
30 |
-
}
|
31 |
-
else{
|
32 |
-
$exclude_post_id = get_option( 'sticky_posts' );
|
33 |
-
}
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
/* ################################ Date query ######################################*/
|
38 |
-
|
39 |
-
if($date_query_type=='extact_date'){
|
40 |
-
$default_query_args['date_query'] = array(
|
41 |
-
'year' => $extact_date_year,
|
42 |
-
'month' => $extact_date_month,
|
43 |
-
'day' => $extact_date_day,
|
44 |
-
);
|
45 |
-
}
|
46 |
-
|
47 |
-
elseif($date_query_type=='between_two_date'){
|
48 |
-
|
49 |
-
$default_query_args['date_query'] = array(
|
50 |
-
|
51 |
-
array(
|
52 |
-
'after' => array(
|
53 |
-
'year' => $between_two_date_after_year,
|
54 |
-
'month' => $between_two_date_after_month,
|
55 |
-
'day' => $between_two_date_after_day,
|
56 |
-
),
|
57 |
-
'before' => array(
|
58 |
-
'year' => $between_two_date_before_year,
|
59 |
-
'month' => $between_two_date_before_month,
|
60 |
-
'day' => $between_two_date_before_day,
|
61 |
-
),
|
62 |
-
'inclusive' => $between_two_date_inclusive,
|
63 |
-
)
|
64 |
-
);
|
65 |
-
}
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
/* ################################ Permission query ######################################*/
|
70 |
-
|
71 |
-
if($permission_query=='enable'){
|
72 |
-
$default_query_args['perm'] = 'readable';
|
73 |
-
}
|
74 |
|
75 |
|
76 |
|
77 |
-
/* ################################ Password query ######################################*/
|
78 |
-
|
79 |
-
if($password_query_type=='has_password'){
|
80 |
-
$default_query_args['has_password'] = $password_query_has_password;
|
81 |
-
}
|
82 |
-
elseif($password_query_type=='post_password'){
|
83 |
-
$default_query_args['post_password'] = $password_query_post_password;
|
84 |
-
}
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
/* ################################ Author query ######################################*/
|
90 |
-
|
91 |
-
$author__in = explode(',', $author__in);
|
92 |
-
$author__not_in = explode(',', $author__not_in);
|
93 |
-
|
94 |
-
$author_query = array();
|
95 |
-
|
96 |
-
if($author_query_type=='author__in'){
|
97 |
-
$default_query_args['author__in'] = $author__in;
|
98 |
-
}
|
99 |
-
|
100 |
-
elseif($author_query_type=='author__not_in'){
|
101 |
-
$default_query_args['author__not_in'] = $author__not_in;
|
102 |
-
}
|
103 |
-
|
104 |
-
//echo '<pre>'.var_export($author_query, true).'</pre>';
|
105 |
-
|
106 |
-
//$author_query = $author_query[0];
|
107 |
-
//$author_query = array_shift($author_query);
|
108 |
-
|
109 |
/* ################################ Tax query ######################################*/
|
110 |
-
//
|
111 |
-
// foreach($categories as $category){
|
112 |
-
//
|
113 |
-
// $tax_cat = explode(',',$category);
|
114 |
-
//
|
115 |
-
// $tax_terms[$tax_cat[0]][] = $tax_cat[1];
|
116 |
-
//
|
117 |
-
// }
|
118 |
-
//
|
119 |
-
// if(empty($tax_terms)){
|
120 |
-
//
|
121 |
-
// $tax_terms = array();
|
122 |
-
// }
|
123 |
-
//
|
124 |
-
// $tax_query_terms = array();
|
125 |
-
//
|
126 |
-
//
|
127 |
-
// foreach($tax_terms as $taxonomy=>$terms){
|
128 |
-
//
|
129 |
-
// $tax_query_terms[] = array(
|
130 |
-
// 'taxonomy' => $taxonomy,
|
131 |
-
// 'field' => 'term_id',
|
132 |
-
// 'terms' => $terms,
|
133 |
-
// 'operator' => $terms_relation,
|
134 |
-
// );
|
135 |
-
//
|
136 |
-
//
|
137 |
-
// }
|
138 |
-
//
|
139 |
-
// if(empty($tax_query)){
|
140 |
-
//
|
141 |
-
// $tax_query = array();
|
142 |
-
//
|
143 |
-
// }
|
144 |
-
//
|
145 |
-
// $tax_query_relation = array( 'relation' => $categories_relation );
|
146 |
-
//
|
147 |
-
// $tax_query[] = array_merge($tax_query_relation, $tax_query_terms );
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
|
152 |
$tax_query = array();
|
153 |
|
@@ -176,42 +39,6 @@ $tax_query = array_merge($tax_query_relation, $tax_query );
|
|
176 |
|
177 |
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
//$default_query_args['tax_query'] = $tax_query;
|
182 |
-
|
183 |
-
//echo '<pre>'.var_export($tax_query, true).'</pre>';
|
184 |
-
|
185 |
-
/* ################################ Meta query ######################################*/
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
//$meta_query = empty($meta_query) ? $meta_query : array();
|
197 |
-
//
|
198 |
-
//
|
199 |
-
//if(!empty($meta_query)){
|
200 |
-
// $meta_query_relation = array('relation' => $meta_query_relation);
|
201 |
-
// $meta_query = array_merge($meta_query_relation, $meta_query );
|
202 |
-
//
|
203 |
-
//}
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
/* ################################ Keyword query ######################################*/
|
216 |
|
217 |
if(isset($_GET['keyword'])){
|
@@ -222,59 +49,20 @@ $tax_query = array_merge($tax_query_relation, $tax_query );
|
|
222 |
|
223 |
|
224 |
|
225 |
-
/*More Query parameter string to array*/
|
226 |
-
if(!empty($extra_query_parameter)){
|
227 |
-
|
228 |
-
$extra_query_parameter = explode('&', $extra_query_parameter);
|
229 |
-
|
230 |
-
foreach($extra_query_parameter as $parameter){
|
231 |
-
|
232 |
-
$parameter = do_shortcode($parameter);
|
233 |
-
$parameter = explode('=', $parameter);
|
234 |
-
|
235 |
-
if (strpos($parameter[1], ',') !== false) {
|
236 |
-
$parameter_args = explode(',', do_shortcode($parameter[1]));
|
237 |
-
$query_parameter[$parameter[0]] = $parameter_args;
|
238 |
-
}
|
239 |
-
else{
|
240 |
-
$query_parameter[$parameter[0]] = ($parameter[1]);
|
241 |
-
}
|
242 |
-
}
|
243 |
-
}
|
244 |
-
else{
|
245 |
-
$query_parameter = array();
|
246 |
-
}
|
247 |
-
|
248 |
-
|
249 |
|
|
|
250 |
|
251 |
-
/* ################################ Archive pages ######################################*/
|
252 |
|
|
|
|
|
|
|
|
|
253 |
|
254 |
-
if($ignore_archive == 'no'):
|
255 |
-
if (is_category() || is_tag() || is_tax() ) {
|
256 |
-
|
257 |
-
$term = get_queried_object();
|
258 |
-
$taxonomy = $term->taxonomy;
|
259 |
-
$terms = $term->term_id;
|
260 |
-
|
261 |
-
$tax_query[] = array(
|
262 |
-
'taxonomy' => $taxonomy,
|
263 |
-
'field' => 'id',
|
264 |
-
'terms' => $terms,
|
265 |
-
);
|
266 |
-
}
|
267 |
|
268 |
-
//var_dump($tax_query);
|
269 |
|
270 |
|
271 |
-
/* ################################ Search pages ######################################*/
|
272 |
|
273 |
-
if(is_search()){
|
274 |
-
$keyword = get_search_query();
|
275 |
-
}
|
276 |
|
277 |
-
endif;
|
278 |
|
279 |
|
280 |
|
@@ -287,8 +75,6 @@ $default_query_args['post_status'] = $post_status;
|
|
287 |
if(!empty($keyword))
|
288 |
$default_query_args['s'] = $keyword;
|
289 |
|
290 |
-
if(!empty($ignore_sticky_posts))
|
291 |
-
$default_query_args['ignore_sticky_posts'] = $ignore_sticky_posts;
|
292 |
|
293 |
if(!empty($exclude_post_id))
|
294 |
$default_query_args['post__not_in'] = $exclude_post_id;
|
@@ -318,8 +104,7 @@ $default_query_args['tax_query'] = $tax_query;
|
|
318 |
if(!empty($meta_query))
|
319 |
$default_query_args['meta_query'] = $meta_query;
|
320 |
|
321 |
-
$query_merge =
|
322 |
-
$query_merge = apply_filters('post_grid_filter_query_args', $query_merge, $grid_id);
|
323 |
|
324 |
|
325 |
$post_grid_wp_query = new WP_Query($query_merge);
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
if ( ! defined('ABSPATH')) exit; // if direct access
|
3 |
|
4 |
|
7 |
|
8 |
$default_query_args = array();
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/* ################################ Tax query ######################################*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
$tax_query = array();
|
16 |
|
39 |
|
40 |
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/* ################################ Keyword query ######################################*/
|
43 |
|
44 |
if(isset($_GET['keyword'])){
|
49 |
|
50 |
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
+
/* ################################ Single pages ######################################*/
|
54 |
|
|
|
55 |
|
56 |
+
if(is_singular()):
|
57 |
+
$current_post_id = get_the_ID();
|
58 |
+
$default_query_args['post__not_in'] = array($current_post_id);
|
59 |
+
endif;
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
|
|
62 |
|
63 |
|
|
|
64 |
|
|
|
|
|
|
|
65 |
|
|
|
66 |
|
67 |
|
68 |
|
75 |
if(!empty($keyword))
|
76 |
$default_query_args['s'] = $keyword;
|
77 |
|
|
|
|
|
78 |
|
79 |
if(!empty($exclude_post_id))
|
80 |
$default_query_args['post__not_in'] = $exclude_post_id;
|
104 |
if(!empty($meta_query))
|
105 |
$default_query_args['meta_query'] = $meta_query;
|
106 |
|
107 |
+
$query_merge = apply_filters('post_grid_filter_query_args', $default_query_args, $grid_id);
|
|
|
108 |
|
109 |
|
110 |
$post_grid_wp_query = new WP_Query($query_merge);
|