Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // First Image Loop
- $args=array(
- 'post_type' => 'animals',
- 'orderby' => 'rand',
- 'posts_per_page' => 7
- );
- $i = 0; // set counter at 0
- $query = new WP_Query($args);
- while($query->have_posts()) : $query->the_post();
- // different code for each image based on the counter
- switch ($i) {
- case 0:
- echo "first image - {$post->ID}";
- break;
- case 1:
- echo "second image - {$post->ID}";
- break;
- case 2:
- echo "third image - {$post->ID}";
- break;
- }
- $i++ // increment counter
- endwhile;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment