<div class="pb-4">
    <?php
    $args = array(
        'hide_empty' => 1,
        'taxonomy' => 'projets-rubrique'
    );
    $terms = get_terms($args);
    if (!empty($terms) && !is_wp_error($terms)) {
        ?>
        <div class="row mb-3">
            <div class="col-12 list-filter input-group">
                <div class="input-group-prepend">
                    <label class="">Ou choisir une thématique: &nbsp;</label>
                </div>
                <form action="">
                    <?php
                    $count = count($terms);
                    echo '<select onchange="location = this.value;" id="rubrique-select" name="rubrique-select" class="custom-select">';
                    echo '<option value="' . get_bloginfo('url') . '/projets/" selected>Tous</option>';
                    foreach ($terms as $term) {
                        if (single_term_title('', false) == $term->name) {
                            echo '<option value="' . get_term_link($term) . '" selected>' . $term->name . '</option>';
                            } else {
                            echo '<option value="' . get_term_link($term) . '">' . $term->name . '</option>';
                            }
                        }
                    echo '</select>';
                    ?>
                </form>
            </div>
        </div>
        <?php
        }
    ?>
    <div class=" grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5">
        <?php
        global $wp_query;
        $maPage = get_query_var('paged');
        $args_actu = array(
            'post_type' => 'projets',
            'post_status' => 'publish',
            'posts_per_page' => 8,
            'paged' => $maPage
        );

        if (isset($atts['cat']) && isset($atts['term']) && !empty($atts['term'])) {
            $args_actu['tax_query'] = array(
                array(
                    'taxonomy' => $atts['cat'],
                    'field' => 'id',
                    'terms' => explode(',', $atts['term'])
                )
            );
            }

        $i = 0;
        $wp_query = new WP_Query($args_actu);
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                get_template_part('template-parts/components/card-agenda');
                wp_reset_postdata();
                }
            wp_reset_postdata();
            } else {
            echo '<p>Il n\'y a aucune actualité pour l\'instant</p>';
            }
        ?>
    </div>
    <?php get_template_part('template-parts/content/content-prev-next', array('prevText' => 'Projets plus récents', 'nextText' => 'Projets plus anciens')); ?>
</div>