Advertisement
Digitalraindrops

loop-logos.php

Jun 8th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. <?php  
  2.     $args = array( 'category_name' => 'logos', 'numberposts' => 3 );
  3.     $lastposts = get_posts( $args );
  4.     if($lastposts) {
  5.         foreach($lastposts as $the_post) $lastpostid[]= $the_post->ID;
  6.     }else{
  7.         $lastpostid[]= 0;
  8.     }
  9.     rewind_posts();
  10.     var_dump( $lastpostid );
  11. ?>
  12.    
  13. <?php
  14. $args = array(
  15.     'category_name' => 'logos',
  16.     'posts_per_page'     => 24,
  17.     'orderby'    => 'rand'
  18. );
  19. ?>
  20.  
  21. <?php query_posts($args); ?>
  22.     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  23.         <div class="thumb">
  24.             <?php if (in_array($post->ID,$lastpostid) ) : ?>
  25.                 <div class="new">
  26.                     <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo("template_directory"); ?>/images/spacer.png" /></a>
  27.                 </div>
  28.             <?php endif ?>
  29.             <?php if (has_post_thumbnail()) {
  30.                 the_post_thumbnail("thumb"); ?>
  31.             <?php }
  32.             else { ?>
  33.                 <img src="<?php bloginfo("template_directory"); ?>/images/thumb.jpg" />
  34.             <?php } ?>
  35.         </div>
  36.     <?php endwhile; else: ?>
  37.         <p><?php _e("Sorry, no posts matched your criteria."); ?></p>
  38.     <?php endif; ?>
  39. <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement