Advertisement
iamdangavin

Check Image Size

Aug 18th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php  
  2.     $featuredPosts = new WP_Query( array(
  3.         'post_type' => array( 'post','collective_slideshow' ),
  4.         'posts_per_page' => 10,
  5.         'orderby' => 'rand'
  6.     ));
  7. ?>
  8. <?php while($featuredPosts->have_posts()) : $featuredPosts->the_post();  ?>
  9.                
  10.     <?php $args = array(
  11.             'post_type' => 'attachment',
  12.             'numberposts' => 1,
  13.             'post_status' => null,
  14.             'post_parent' => $post->ID,
  15.            
  16.             );
  17.             $attachments = get_posts($args);
  18.             foreach ($attachments AS $attachment) {
  19.             $imgid = $attachment->ID;
  20.             $meta = wp_get_attachment_metadata($imgid);
  21.             $imgw = $meta['sizes']['collective-slide']['width'];
  22.             if ($imgw == "870") {?>
  23.             <div class="slide">
  24.                 <div class="slideshow title">
  25.                     <h2><?php echo get_the_title($post->post_parent); ?></h2>
  26.                 </div><!-- .title -->
  27.                 <div class="image">
  28.                     <?php echo the_post_thumbnail('collective-slide'); ?>
  29.                 </div><!-- .image -->
  30.             </div><!-- .slide -->
  31.             <?php
  32.             }
  33.             }
  34.     ?>
  35.            
  36. <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement