Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 28th, 2013  |  syntax: None  |  size: 0.50 KB  |  views: 296  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php $do_not_duplicate[] = 0; $i = 0; ?>
  2.         <?php $query = new WP_Query( 'posts_per_page=-1' ); ?>
  3.         <?php if ( have_posts() ) : while ( have_posts() && $i<6 ) : $query->the_post();
  4.                 $category = get_the_category();
  5.                 if (!in_array($category[0]->cat_ID, $do_not_duplicate)) :
  6.                         $do_not_duplicate[] = $category[0]->cat_ID;
  7.                         $i++;
  8.         ?>
  9.                         <!--[HTML for show posts]-->
  10.                        
  11.         <?php endif; ?>
  12.        
  13.         <?php endwhile; else: ?>
  14.         <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
  15.         <?php endif; ?>