Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array( 'category_name' => 'logos', 'numberposts' => 3 );
- $lastposts = get_posts( $args );
- if($lastposts) {
- foreach($lastposts as $the_post) $lastpostid[]= $the_post->ID;
- }else{
- $lastpostid[]= 0;
- }
- rewind_posts();
- var_dump( $lastpostid );
- ?>
- <?php
- $args = array(
- 'category_name' => 'logos',
- 'posts_per_page' => 24,
- 'orderby' => 'rand'
- );
- ?>
- <?php query_posts($args); ?>
- <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
- <div class="thumb">
- <?php if (in_array($post->ID,$lastpostid) ) : ?>
- <div class="new">
- <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo("template_directory"); ?>/images/spacer.png" /></a>
- </div>
- <?php endif ?>
- <?php if (has_post_thumbnail()) {
- the_post_thumbnail("thumb"); ?>
- <?php }
- else { ?>
- <img src="<?php bloginfo("template_directory"); ?>/images/thumb.jpg" />
- <?php } ?>
- </div>
- <?php endwhile; else: ?>
- <p><?php _e("Sorry, no posts matched your criteria."); ?></p>
- <?php endif; ?>
- <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement