PluginProbe
WP Ultimate Post Grid / 2.4.0
WP Ultimate Post Grid v2.4.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
← All changes | helpers/models/grid.php +51 -2 2.02.4.0 View file →
@@ -5,9 +5,11 @@
5 5 private $post;
6 6 private $meta;
7 7 private $fields = array(
8 8 'wpupg_centered',
9 + 'wpupg_empty_message',
9 10 'wpupg_images_only',
11 + 'wpupg_filter_count',
10 12 'wpupg_filter_inverse',
11 13 'wpupg_filter_limit',
12 14 'wpupg_filter_limit_exclude',
13 15 'wpupg_filter_match_parents',
@@ -12,12 +14,14 @@
12 14 'wpupg_filter_limit_exclude',
13 15 'wpupg_filter_match_parents',
14 16 'wpupg_filter_multiselect',
15 17 'wpupg_filter_multiselect_type',
18 + 'wpupg_filter_show_empty',
16 19 'wpupg_filter_type',
17 20 'wpupg_pagination_type',
18 21 'wpupg_post_types',
19 22 'wpupg_layout_mode',
23 + 'wpupg_limit_terms',
20 24 'wpupg_limit_posts',
21 25 'wpupg_limit_posts_number',
22 26 'wpupg_link_target',
23 27 'wpupg_link_type',
@@ -89,9 +93,13 @@
89 93 'padding_vertical' => '5',
90 94 'padding_horizontal' => '10',
91 95 'alignment' => 'left',
92 96 'all_button_text' => 'Check Constructor',
97 + 'term_order' => 'alphabetical',
93 98 ),
99 + 'text' => array(
100 + 'placeholder_text' => '',
101 + ),
94 102 );
95 103
96 104 public function __construct( $post )
97 105 {
@@ -157,8 +165,13 @@
157 165 {
158 166 return $this->meta( 'wpupg_centered' );
159 167 }
160 168
169 + public function empty_message()
170 + {
171 + return $this->meta( 'wpupg_empty_message' );
172 + }
173 +
161 174 public function filter()
162 175 {
163 176 return $this->meta( 'wpupg_filter' );
164 177 }
@@ -187,8 +200,17 @@
187 200 $dropdown_labels = maybe_unserialize( $this->meta( 'wpupg_filter_dropdown_labels' ) );
188 201 return is_array( $dropdown_labels ) ? $dropdown_labels : array();
189 202 }
190 203
204 + public function filter_count()
205 + {
206 + if( WPUltimatePostGrid::is_premium_active() ) {
207 + return $this->meta( 'wpupg_filter_count' );
208 + } else {
209 + return false;
210 + }
211 + }
212 +
191 213 public function filter_inverse()
192 214 {
193 215 return $this->meta( 'wpupg_filter_inverse' );
194 216 }
@@ -227,8 +249,13 @@
227 249 {
228 250 return $this->meta( 'wpupg_filter_multiselect_type' );
229 251 }
230 252
253 + public function filter_show_empty()
254 + {
255 + return $this->meta( 'wpupg_filter_show_empty' );
256 + }
257 +
231 258 public function filter_type()
232 259 {
233 260 return $this->meta( 'wpupg_filter_type' );
234 261 }
@@ -248,8 +275,24 @@
248 275 $layout_mode = $this->meta( 'wpupg_layout_mode' );
249 276 return $layout_mode ? $layout_mode : 'masonry';
250 277 }
251 278
279 + public function limit_terms()
280 + {
281 + return $this->meta( 'wpupg_limit_terms' );
282 + }
283 +
284 + public function limit_terms_terms()
285 + {
286 + $limit_terms_terms = maybe_unserialize( $this->meta( 'wpupg_limit_terms_terms' ) );
287 + return is_array( $limit_terms_terms ) ? $limit_terms_terms : array();
288 + }
289 +
290 + public function limit_terms_type()
291 + {
292 + return $this->meta( 'wpupg_limit_terms_type' );
293 + }
294 +
252 295 public function limit_posts()
253 296 {
254 297 return $this->meta( 'wpupg_limit_posts' );
255 298 }
@@ -431,9 +474,9 @@
431 474 if( count( $post_ids ) == 0 ) return array();
432 475
433 476 $posts_per_page = -1;
434 477
435 - if( $this->pagination_type() == 'pages' ) {
478 + if( $page !== -2 && $this->pagination_type() == 'pages' ) {
436 479 $pagination = $this->pagination();
437 480 $posts_per_page = $pagination['pages']['posts_per_page'];
438 481 }
439 482
@@ -442,9 +485,9 @@
442 485 $offset = $page * $posts_per_page;
443 486 }
444 487
445 488 $args = array(
446 - 'post_type' => 'any',
489 + 'post_type' => $this->post_types(), // "any" doesn't work for private post types.
447 490 'post_status' => 'any',
448 491 'order' => $this->order(),
449 492 'posts_per_page' => $posts_per_page,
450 493 'offset' => $offset,
@@ -518,8 +561,14 @@
518 561 'orderby' => $this->terms_order_by(),
519 562 'order' => $this->terms_order(),
520 563 'hide_empty' => $this->terms_hide_empty(),
521 564 );
565 +
566 + if( $this->limit_terms() ) {
567 + $type = $this->limit_terms_type() == 'restrict' ? 'include' : 'exclude';
568 +
569 + $args[$type] = $this->limit_terms_terms();
570 + }
522 571
523 572 if( $this->terms_images_only() ) {
524 573 $args['meta_query'] = array(
525 574 array(