Advertisement
Digitalraindrops

Four Post Images

Apr 19th, 2012
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php if (have_posts()) : ?>
  2.     <?php $counter = 0; ?>
  3.     <?php while (have_posts()) : ?>
  4.         <?php the_post(); ?>       
  5.         <?php $counter++; ?>
  6.         <?php $column = $counter % 4; ?>
  7.         <?php $class = ( $column ) ? '<div class="threecol">' : '<div class="threecol last">';
  8.     <?php if( $column == 1 ): // Open the Row?>
  9.         <div class="row">
  10.     <?php endif; ?>
  11.         echo $class;
  12.             <div id="post" <?php post_class(); ?>>
  13.                 <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  14.                 <?php if( has_post_thumbnail() ) the_post_thumbnail( 'thumbnail' ); ?>
  15.             </div>
  16.         </div>
  17.     <?php if( !$column ): // Close the Row ?>
  18.         </div>
  19.         <div style="clear:both;"></div>    
  20.     <?php endif; ?>
  21.     <?php endwhile; ?>
  22. <?php if( $column ) : //Finished on an odd number close Row ?>
  23.     <div style="clear:both;"></div>
  24. <?php endif; ?>
  25. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement