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/grid_cache.php +40 -5 2.22.4.0 View file →
@@ -39,16 +39,21 @@
39 39
40 40 $query = new WP_Query( $args );
41 41 $posts = $query->have_posts() ? $query->posts : array();
42 42
43 + $grid_ids = array();
43 44 foreach ( $posts as $grid_post )
44 45 {
45 46 $grid = new WPUPG_Grid( $grid_post );
46 47
47 48 if( in_array( $post_type, $grid->post_types() ) ) {
48 - $this->generate( $grid->ID() );
49 + $grid_ids[] = $grid->ID();
49 50 }
50 51 }
52 +
53 + if( count( $grid_ids ) > 0 ) {
54 + update_option( 'wpupg_regenerate_grids_check', $grid_ids );
55 + }
51 56 }
52 57
53 58 public function updated_term( $term_id, $taxonomy )
54 59 {
@@ -286,9 +291,9 @@
286 291
287 292 // Generate Filter
288 293 $filter = '';
289 294
290 - if( count( $filter_terms ) > 0 && $grid->filter_type() == 'isotope' ) {
295 + if( count( $filter_terms ) > 0 && ($grid->filter_type() == 'isotope' ) || $grid->filter_type() == 'text_isotope') {
291 296 $filter_style = $grid->filter_style();
292 297
293 298 // All Button
294 299 if( $filter_style['isotope']['all_button_text'] ) {
@@ -294,10 +299,36 @@
294 299 if( $filter_style['isotope']['all_button_text'] ) {
295 300 $filter .= '<div class="wpupg-filter-item wpupg-filter-isotope-term wpupg-filter-tag- active">' . $filter_style['isotope']['all_button_text'] . '</div>';
296 301 }
297 302
298 - $filter_terms_order = array_keys( $filter_terms );
299 - sort( $filter_terms_order );
303 + $filter_terms_order = array();
304 +
305 + if( $filter_style['isotope']['term_order'] == 'alphabetical_taxonomies' || $filter_style['isotope']['term_order'] == 'reverse_alphabetical_taxonomies' ) {
306 + // Order alphatically per taxonomy
307 + $terms_per_taxonomy = array();
308 +
309 + foreach( $filter_terms as $slug => $term ) {
310 + $taxonomy = $term['taxonomy'];
311 + if( !array_key_exists( $taxonomy, $terms_per_taxonomy ) ) {
312 + $terms_per_taxonomy[$taxonomy] = array();
313 + }
314 + $terms_per_taxonomy[$taxonomy][] = $slug;
315 + }
316 +
317 + foreach( $terms_per_taxonomy as $taxonomy => $terms ) {
318 + sort( $terms );
319 + $filter_terms_order = array_merge( $filter_terms_order, $terms );
320 + }
321 + } else {
322 + // Order alphabetically by default
323 + $filter_terms_order = array_keys( $filter_terms );
324 + sort( $filter_terms_order );
325 + }
326 +
327 + if( $filter_style['isotope']['term_order'] == 'reverse_alphabetical_taxonomies' || $filter_style['isotope']['term_order'] == 'reverse_alphabetical' ) {
328 + $filter_terms_order = array_reverse( $filter_terms_order );
329 + }
330 +
300 331 $filter_terms_order = apply_filters( 'wpupg_grid_cache_filter_isotope_term_order', $filter_terms_order, $grid );
301 332
302 333 foreach( $filter_terms_order as $slug ) {
303 334 $options = isset( $filter_terms[$slug] ) ? $filter_terms[$slug] : false;
@@ -308,10 +339,14 @@
308 339 } else {
309 340 $name = $options['name'];
310 341 }
311 342
312 - $filter .= '<div class="wpupg-filter-item wpupg-filter-isotope-term wpupg-filter-tag-' . $slug . '" data-taxonomy="' . $options['taxonomy'] . '" data-filter="' . $slug . '">' . $name . '</div>';
343 + $filter .= '<div class="wpupg-filter-item wpupg-filter-isotope-term wpupg-filter-isotope-term-' . $options['taxonomy'] . ' wpupg-filter-tag-' . $slug . '" data-taxonomy="' . $options['taxonomy'] . '" data-filter="' . $slug . '">' . $name . '</div>';
313 344 }
345 + }
346 +
347 + if( $grid->filter_type() == 'text_isotope' && WPUltimatePostGrid::is_addon_active('filter-text') ) {
348 + $filter .= WPUltimatePostGrid::addon('filter-text')->get_filter( $grid );
314 349 }
315 350 }
316 351
317 352 // Update Metadata