Advertisement
alchymyth

related-posts two col

Nov 13th, 2011
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <h3> Related Posts</h3>
  2. <?php if ($related_query->have_posts()):?>
  3. <ul class="related-posts">
  4.     <?php while ($related_query->have_posts()) : $related_query->the_post(); ?>
  5.     <li class="<?php echo ($oddeven = ($oddeven == 'odd') ? 'even' : 'odd'); ?>">  <?php $postimageurl = get_post_meta($post->ID, 'image', true); if ($postimageurl) { ?>
  6.             <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/thumb.php?src=<?php echo $postimageurl; ?>&h=150&w=300&zc=1&q=100" alt="<?php the_title(); ?>" width="300" height="150"/><br /></a>
  7.             <?php } else { ?>
  8.             <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/thumb.php?src=<?php bloginfo('stylesheet_directory'); ?>/default.jpg&h=100&w=100&zc=1&q=100" alt="<?php the_title(); ?>" width="200" height="100"/></a>
  9.             <?php } ?>
  10.             <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
  11.  
  12.             <p class="post_meta"><span class="details"><?php _e('Archived in ', 'woothemes' ); ?> <?php the_category(', ') ?></span></p></li>
  13.  
  14.     <?php endwhile; ?>
  15. </ul>
  16. <div class="clear-list"></div>
  17.  
  18. <?php else: ?>
  19. <p>No related posts.</p>
  20. <?php endif; ?>
  21.  
  22. styles for this:
  23. .related-posts li.odd { float:left; width: 50%; clear:left; }
  24. .related-posts li.even { float:left; width: 50%; }
  25. .clear-list { float:none; clear: both; display:block; visibility: hidden; }
  26.  
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement