how to print loops for odd in 1st column and even in 2nd column in wordpress [closed]

Your code is creating two divs for every post – a <div class="container left"> and a <div class="container right">. One is empty each time, because you then check the $counter variable (which you’ve set to the post ID), and so only one of the divs ends up containing a post.

Tom’s suggestion to use CSS nth-child is more practical. For one thing, post IDs are not always going to increment in order. If an author edits a post (with revisions on) or anytime someone uploads media or adds another post type, that post will now have the next ID, so the posts you’re pulling here are very likely to be non-sequential and thus you will sometimes end up with two "container left" divs in a row or two "container right" divs in a row, because their post IDs will both be odd or even. For another, this will also solve your problem of outputting 2 divs every iteration.