<?php get_header(); ?>
<div class="container">
<div class="row">
<?php
$args = array(
'posts_per_page' => 15, // 3 colonne x 5 righe = 15 post
);
$query = new WP_Query($args);
if ($query->have_posts()) :
$count = 0;
while ($query->have_posts()) : $query->the_post();
if ($count % 3 == 0) echo '<div class="row">'; // Inizia una nuova riga ogni 3 post
?>
<div class="col-md-4">
<div class="post-box">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('thumbnail'); // Immagine piccola ?>
</a>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php echo wp_trim_words(get_the_excerpt(), 15); // Introduzione breve ?></p>
</div>
</div>
<?php
$count++;
if ($count % 3 == 0) echo '</div>'; // Chiudi la riga dopo 3 post
endwhile;
wp_reset_postdata();
endif;
?>
</div>
</div>
<?php get_footer(); ?>