console.log( 'Code is Poetry' );
<?php
/*
Template Name: Blog Pinterest
*/
get_header(); ?>

<style>
  /* CSS pour la grille de type Pinterest */
  .pinterest-grid {
    display: grid;
    /* Les colonnes s'adaptent automatiquement en fonction de la largeur */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-gap: 15px;
    margin: 0 auto;
    max-width: 1200px;
  }
  .pinterest-item {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
  }
  .pinterest-item:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  }
  .pinterest-item img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
  }
  .pinterest-item h2 {
    font-size: 1.25em;
    margin: 0 0 10px;
  }
  .pinterest-item p {
    font-size: 0.95em;
    line-height: 1.5;
  }
</style>

<div class="pinterest-grid">
  <?php
  // Lancer la boucle WordPress pour récupérer les articles
  if ( have_posts() ) :
    while ( have_posts() ) : the_post(); ?>
      <div class="pinterest-item">
        <a href="<?php the_permalink(); ?>">
          <?php
          // Affichage de l'image mise en avant (thumbnail)
          if ( has_post_thumbnail() ) {
            the_post_thumbnail('medium');
          }
          ?>
        </a>
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <p><?php echo wp_trim_words( get_the_excerpt(), 20, '...' ); ?></p>
      </div>
  <?php
    endwhile;
  else :
    echo '<p>Aucun article trouvé.</p>';
  endif;
  ?>
</div>

<?php get_footer(); ?>