I created a custom grid to have this display :
Now i need to add an id (with an incremental number) to every row so i can use it as anchor. I tried to regroup every three blocs in one div but i couldn't do it.
<?php
if ( $query->have_posts() ) {
while ( $query->have_posts() ) : $query->the_post(); ?>
<?php if ($i % 3 == 0) { ?>
<div class="projet-bloc-empty col-md-4"><div></div></div>
<div class="projet-bloc-empty col-md-4"><div></div></div>
<div class="projet-bloc-empty col-md-4"><div></div></div>
<?php } ?>
<div class="projet-bloc col-md-4">
<a href="<?php echo $post->post_name ?>" title="<?php echo $post->post_title ?>">
<?php echo get_the_post_thumbnail($post->ID); ?>
</a>
</div>
<?php $i++; endwhile; ?>
<?php } ?>