I created two different styles for posts. The source code is here: wpbeginner.com/wp-themes/how-to-style-each-wordpress-post-differently.
And this is my code:
<?php $count = 0; ?>
<?php query_posts($query_string.'&posts_per_page=30'); while (have_posts()) : the_post(); ?>
<?php $count++; ?>
<?php if ($count == 1) : ?>
<div id="listpostsleft">
<article id="listpostsleft-<?php the_ID(); ?>" <?php post_class("listpostsleft clearfix $class"); ?>>
text images
</article>
</div>
<div class="clear"></div>
<?php elseif ($count == 2) : ?>
<div id="listpostsright">
<article id="listpostsright-<?php the_ID(); ?>" <?php post_class("listpostsright clearfix $class"); ?>>
images text
</article>
</div>
<div class="clear"></div>
<?php else : ?>
<div id="listpostsleft">
<article id="listpostsleft-<?php the_ID(); ?>" <?php post_class("listpostsleft clearfix $class"); ?>>
text images
</article>
</div>
</article>
</div>
<div class="clear"></div>
<?php endif; ?>
<?php endwhile; ?>
<?php pagination()?>
<?php else : ?>
<p><?php _e( 'Sorry, nothing found.' ); ?></p>
<?php endif; ?>
But the result is this: https://i.sstatic.net/yDTOQ.jpg
And what I intend to do is this:
The first post should be to the right side and the second to the left side. The style of the other posts should follow the same standard in an infinite loop.
How can I do this?
Sorry my english!