FEATURE Handling active filters when page has query vars
This commit is contained in:
parent
86864d3132
commit
965f097507
|
|
@ -4,22 +4,23 @@ $posts_query = $args['posts_query'] ?? null;
|
|||
$post_count = $posts_query->post_count;
|
||||
$current_post_type_obj = get_post_type_object($current_post_type);
|
||||
|
||||
$etiquette_active_filter_slug = $args['etiquette_active_filter_slug'] ?? null;
|
||||
|
||||
$post_ids = wp_list_pluck($posts_query->posts, 'ID');
|
||||
|
||||
$types = get_terms(array(
|
||||
'taxonomy' => 'type',
|
||||
'hide_empty' => true,
|
||||
'taxonomy' => 'type',
|
||||
'hide_empty' => true,
|
||||
));
|
||||
|
||||
$authors = get_authors_linked_to_posts($post_ids);
|
||||
$tags = get_terms(array(
|
||||
'taxonomy' => 'etiquettes',
|
||||
'hide_empty' => true,
|
||||
'object_ids' => $post_ids,
|
||||
'taxonomy' => 'etiquettes',
|
||||
'hide_empty' => true,
|
||||
'object_ids' => $post_ids,
|
||||
));
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<div class="post-grid__toolbar">
|
||||
<div class="search-by">
|
||||
|
|
@ -39,7 +40,7 @@ $tags = get_terms(array(
|
|||
<select name="etiquettes">
|
||||
<option value=""><?php _e('Tous les tags', 'dynamiques'); ?></option>
|
||||
<?php foreach ($tags as $tag) : ?>
|
||||
<option value="<?php echo $tag->slug; ?>"><?php echo $tag->name; ?></option>
|
||||
<option value="<?php echo $tag->slug; ?>" <?php selected($etiquette_active_filter_slug, $tag->slug); ?>><?php echo $tag->name; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
|
|
@ -71,4 +72,4 @@ $tags = get_terms(array(
|
|||
<option value="date_asc"><?php _e('Numéros anciens en premier', 'dynamiques'); ?></option>
|
||||
<option value="title_asc"><?php _e('Par ordre alphabétique', 'dynamiques'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user