There are some posts that have a photo that is 2x1, and others that have a photo of 1x2 (I mean those photos):
In addition, there are 3 columns. Bootstrap can do this easily:
<div class="row">
<div class="col-md-4">
<!-- conteudo -->
</div>
<div class="col-md-4">
<!-- conteudo -->
</div>
<div class="col-md-4">
<!-- conteudo -->
</div>
</div>
Its logic, however, will have to analyze the image of each post inside the loop and verify:
If this post is part of this <div class="row">
, or need to start another
If the post is listed as one, or two columns.
If the post consists of two rows, you will have to skip the third column in the next row
Example
Note: This is not code that you can simply copy and paste into your application - it's just an attempt to show something appeared / p>
<?php
$colunas = 3;
$coluna_corrente = 0;
$duas_rows = false;
?>
<?php if ( have_posts() ) : ?>
<?php while( have_posts() ) : the_post(); ?>
<?php
++$coluna_corrente;
if ( $coluna_corrente % $colunas == 0 ) {
echo "<div class='row'>";
}
if ( tamanho_relativa_da_foto( $colunas, $post->foto ) < 2 ) { //esse função não existe
echo '<div class="col-md-4">';
the_title();
//algo mais
echo "</div>";
} else if ( tamanho_relativa_da_foto( $colunas, $post->foto ) == 2 && !$duas_rows ) {
echo '<div class="col-md-8">';
//etc...
echo '</div>';
} else {
$duas_rows = true;
echo '<div class="col-md-4">';
//...
echo '</div>';
}
if ( $coluna_corrente == $colunas ) {
echo "</div>";
}
?>
<?php endwhile; ?>
<?php endif; ?>