FEATURE Optimizing explore tags link target and behaviour
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bc7b23cc1b
commit
d92ea138b1
|
|
@ -1,9 +1,26 @@
|
|||
<?php
|
||||
$articles = new WP_Query(array(
|
||||
// Récupérer le paramètre etiquette de l'URL
|
||||
$etiquette_slug = isset($_GET['etiquette']) ? sanitize_text_field($_GET['etiquette']) : '';
|
||||
|
||||
// Construire les arguments de la query
|
||||
$query_args = array(
|
||||
'post_type' => 'articles',
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'publish',
|
||||
));
|
||||
);
|
||||
|
||||
// Si on a une étiquette, ajouter le filtre taxonomy
|
||||
if (!empty($etiquette_slug)) {
|
||||
$query_args['tax_query'] = array(
|
||||
array(
|
||||
'taxonomy' => 'etiquettes',
|
||||
'field' => 'slug',
|
||||
'terms' => $etiquette_slug,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$articles = new WP_Query($query_args);
|
||||
$post_count = $articles->post_count;
|
||||
$authors = get_posts(array(
|
||||
'post_type' => 'auteurs',
|
||||
|
|
@ -36,9 +53,11 @@ $thematiques = get_terms(array(
|
|||
<div class="post-grid__toolbar-actions">
|
||||
|
||||
<select name="etiquettes">
|
||||
<option value="1"><?php _e('Tous les tags', 'dynamiques'); ?></option>
|
||||
<option value=""><?php _e('Tous les tags', 'dynamiques'); ?></option>
|
||||
<?php foreach ($thematiques as $thematique) : ?>
|
||||
<option value="<?php echo $thematique->term_id; ?>"><?php echo $thematique->name; ?></option>
|
||||
<option value="<?php echo $thematique->slug; ?>" <?php selected($etiquette_slug, $thematique->slug); ?>>
|
||||
<?php echo $thematique->name; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<select name="auteurs">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user