| @@ -247,8 +247,41 @@ | ||
| 247 | 247 | $terms_per_post[$post_id][$taxonomy] = $post_taxonomy_term_ids; |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | + // Show Empty Terms | |
| 252 | + if( $grid->filter_show_empty() ) { | |
| 253 | + foreach( $taxonomies as $taxonomy ) { | |
| 254 | + $terms = get_terms( $taxonomy, array( | |
| 255 | + 'hide_empty' => false, | |
| 256 | + ) ); | |
| 257 | + | |
| 258 | + foreach( $terms as $term ) { | |
| 259 | + // Check if terms are being limited | |
| 260 | + if( $grid->filter_limit() ) { | |
| 261 | + if( $grid->filter_limit_exclude() ) { | |
| 262 | + if( isset( $limit_terms[$taxonomy] ) && in_array( $term->term_id, $limit_terms[$taxonomy] ) ) continue; | |
| 263 | + } else { | |
| 264 | + if( !isset( $limit_terms[$taxonomy] ) || !in_array( $term->term_id, $limit_terms[$taxonomy] ) ) continue; | |
| 265 | + } | |
| 266 | + } | |
| 267 | + | |
| 268 | + $slug = urldecode( $term->slug ); | |
| 269 | + | |
| 270 | + if( !isset( $posts_per_term[$taxonomy][$slug] ) ) $posts_per_term[$taxonomy][$slug] = array(); | |
| 271 | + | |
| 272 | + if( !array_key_exists( $slug, $filter_terms ) ) { | |
| 273 | + // Filter terms | |
| 274 | + $filter_terms[$slug] = array( | |
| 275 | + 'taxonomy' => $taxonomy, | |
| 276 | + 'name' => $term->name, | |
| 277 | + 'count' => 0, | |
| 278 | + ); | |
| 279 | + } | |
| 280 | + } | |
| 281 | + } | |
| 282 | + } | |
| 283 | + | |
| 251 | 284 | $cache['taxonomies'] = $posts_per_term; |
| 252 | 285 | $cache['terms'] = $terms_per_post; |
| 253 | 286 | |
| 254 | 287 | // Generate Filter |