• I want to display four posts, but I need each to have a numeric class. That’s to say, I want a 1, 2, 3, or 4 where “n” is below.

    <?php query_posts('showposts=4&cat=6');?>
    
    <?php while ( have_posts() ) : the_post() ?>
    
    <li><a href="#" class="n"><img src="<?php echo get_post_meta($post->ID, "wppt_preset2", true); ?>"></a></li>
    
    <?php endwhile; ?>

    Ideas?

Viewing 1 replies (of 1 total)
  • do you mean:

    <?php query_posts('showposts=4&cat=6');?>
    <?php $counter = 1; ?>
    <?php while ( have_posts() ) : the_post() ?>
    
    <li><a href="#" class="<?php echo $counter; $counter++; ?>"><img src="<?php echo get_post_meta($post->ID, "wppt_preset2", true); ?>"></a></li>
    
    <?php endwhile; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Numeric post classes’ is closed to new replies.