Listing Side by Side

1

I'm trying to list the news in wordpress, but I want to list side by side, I did the while wordpress default to list the news como eu fiz abaixo

Result:

Iwantedthenewstobesidebysideandnotrepeated...

Ididanothertest,Iremovedthenextcolumncomoeufizabaixo ItworksthewayIwantitjustgoesoutoftheway

    
asked by anonymous 04.04.2017 / 15:50

1 answer

1

You can do this as follows:

<?php 
  $i = 0;
  while( have_posts() ) : the_post(); 
    if( $i % 2 == 0 ) : 
?>
      //html da coluna da esquerda
<?php 
    else:
?>
      //html da coluna da direita
<?php 
    endif;
    $i++;
  endwhile;
?>

This way you guarantee that each one will be printed with the respective characteristic of each column.

    
04.04.2017 / 16:08