Jak wyświetlić posty WordPress w 3 kolumnach w poziomie?
Integruję mój motyw zbudowany z Bootstrap do WordPress i teraz stoję przed wyzwaniem wyświetlania moich postów poziomo zamiast pionowo. Projekt wykorzystuje 3 kolumny.
Rozwiązanie dla dwóch kolumn opublikowanych w tej witrynie (http://perishablepress.com/two-column-horizontal-sequence-wordpress-post-order/) był pomocny, ale publikuje powtórzenia wcześniej wyświetlanych postów, gdy jest używany z 3 kolumnami.
Oto mój kod:
<div class="row">
<?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) == 0) : $wp_query->next_post(); else : the_post(); ?>
<div class="col-sm-4">
<img src="<?php the_field('home_page_slider_image'); ?>" class="img-responsive" >
<h3><?php the_field( 'description' ); ?></h3>
</div>
<?php endif; endwhile; else: ?>
<div>Alternate content</div>
<?php endif; ?>
<?php $i = 0; rewind_posts(); ?>
<?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query->next_post(); else : the_post(); ?>
<div class="col-sm-4">
<img src="<?php the_field('home_page_slider_image'); ?>" class="img-responsive" >
<h3><?php the_field( 'description' ); ?></h3>
</div>
<?php endif; endwhile; else: ?>
<div>Alternate content</div>
<?php endif; ?>
<?php $i = 0; rewind_posts(); ?>
<?php if (have_posts()) : while(have_posts()) : $i++; if(($i % 2) !== 0) : $wp_query->next_post(); else : the_post(); ?>
<div class="col-sm-4">
<img src="<?php the_field('home_page_slider_image'); ?>" class="img-responsive" >
<h3><?php the_field( 'description' ); ?></h3>
</div>
<?php endif; endwhile; else: ?>
<div>Alternate content</div>
<?php endif; ?>
</div>
Każda pomoc byłaby wdzięczna.
Dziękuję Ci.