Add class to featured thumb array
-
I’m using the following code to display featured images of a category. It shows them inline and my css has a right-margin of 20px. The problem is the last image in the array still has the right-margin and I want to override this with a right-margin of 0.
Normally, I would add a class called .last and create a custom style for this but I can’t get that to work with my code below. Any ideas?Thanks,
Bob<?php $args = array( 'post__in' => get_option('sticky_posts'), 'cat' => 4, 'showposts' => 4, 'orderby' => date, 'order' => 'desc' ); $sticky = new WP_Query( $args ); if ( $sticky->have_posts() ): while ( $sticky->have_posts() ): $sticky->the_post(); ?> <a href="<?php the_permalink(); ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('homepage-thumb'); } endwhile; endif; wp_reset_query(); ?></a>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Add class to featured thumb array’ is closed to new replies.