want to use acounter to custom first , second and third post in the loop
-
Hi,
I want to use a counter to custom first , second and third post styles in the loop
I used this code to custom only the first post :<?php $i = 1; ?> <?php $otherFeaturedPost = new WP_Query(); $otherFeaturedPost->query('showposts=4&offset=0'); ?> <?php while ($otherFeaturedPost->have_posts()) : $otherFeaturedPost->the_post(); ?> <?php if($i <= 1) { ?> <a href="#fragment-1"> <?php the_post_thumbnail( array( 'class' => 'emadsss5' )); ?> <span><?php the_title(); ?></span></a> <?php } else { ?> <a href="#fragment-2"> <?php the_post_thumbnail( array( 'class' => 'emadsss5' )); ?> <span><?php the_title(); ?></span></a> <?php } ?> <?php $i++; endwhile; wp_reset_query(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘want to use acounter to custom first , second and third post in the loop’ is closed to new replies.