Advertisement
Digitalraindrops

latest cats list

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