custom post types – Page that lists publications by classifying them by taxonomy
I need a little help writing code. I have an “artists” CPT I have an archive-artists.php page with the code below, but I would need to add a “year” taxonomy. And that my artist list is divided into several sections, with my title taxonomies.
2021 in title and the list of artists 2021 below
2020 in title and the list of artists 2020 below
And I don’t know how to add that, it’s kind of a loop within a loop.
<?php $loopfuture = new WP_Query( array( 'post_type' => 'artists', 'order' => 'DSC' ) ); ?> <div id="flexartists"> <?php while ( $loopfuture->have_posts() ) : $loopfuture->the_post(); ?> <div class="artistflex"> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('event-image size'); ?></a> <h3><?php the_title( '' );?></h3> <div class="projetartist"><?php the_field( 'le_projet' );?></div> <a href="<?php the_permalink() ?>" class="moreagenda">Read more</a> </div> <?php endwhile; wp_reset_query(); ?> </div>