Skip to content

Instantly share code, notes, and snippets.

@ihorduchenko
Created April 25, 2017 08:36
Show Gist options
  • Save ihorduchenko/36e5ded87b7a9d98be0c754fe7ba27cc to your computer and use it in GitHub Desktop.
Save ihorduchenko/36e5ded87b7a9d98be0c754fe7ba27cc to your computer and use it in GitHub Desktop.
Cross-browser loop using table
$query = new WP_Query( $args );
if ( $query->have_posts() ) { ?>
<table>
<?php $i = 0;
while( $query->have_posts() ) {
$query->the_post(); ?>
<?php if($i == 0){ echo "<tr>"; }?>
<td class="item_post_man">
<a href="<?php echo get_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('thumb_product_cat', array( 'class' => 'img-responsive' ));
} ?>
<p class="title_man"><?php the_title(); ?></p>
</a>
</td>
<?php $i++;?>
<?php if($i == 3){ echo "</tr>"; $i=0;}?>
<?php } ?>
</table>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment