Giving php generated divs different classes
-
I’m wondering if its possible to generate a different class for each div that this php code generates. Theres a total of 5 divs that are going to be displayed after the script has ran.
<?php $top_query = new WP_Query('cat=CaseStudies&showposts=5'); ?> <?php while($top_query->have_posts()) : $top_query->the_post(); ?> <?php echo '<div class="col-md-2 break project-img middle no-pad-mar">'; echo '<div class="case caseimg">'; the_post_thumbnail( 'thumbnail' ); ?> <a href>/'"> <span class="blk"><strong>Project Title</strong></span> <span>Location</span></a> <?php echo '</div>'; echo '</div>'; ?> <?php $count1++; ?> <?php endwhile; ?>
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Giving php generated divs different classes’ is closed to new replies.