mardi 19 mai 2015

How to divide post into row with to post like wise in wordpress

I want to get wordpress post by selected category and display it like following

<div class="row">
  <div class="item"></div>
  <div class="item"></div>
</div>
<div class="row">
  <div class="item"></div>
  <div class="item"></div>
</div>
<div class="row">
  <div class="item"></div>
  <div class="item"></div>
</div>
...

I don't have any idea how to loop this post. Can anyone help me to solve this problem?

this is my wordpress code

<?php $args = array(
        'numberposts'     => 99999,
        'category_name'      => 'res-image-gallery');

                $the_query = new WP_Query( $args );

                if ( $the_query->have_posts() ) :

                    while ( $the_query->have_posts() ) : $the_query->the_post();  ?>
                        //this block should like row with to post...
                        <div class="row">
                            <div class="item"> </div>
                            <div class="item"> </div>
                        </div>
                    <?php endwhile;?>

                <?php endif;?>

Aucun commentaire:

Enregistrer un commentaire