I have downloaded a theme that uses this code to produce the links for my main nav –
<?php $i = 1; while ( have_posts() ) : the_post(); echo '<li><a href="#block';?><?php echo $i; ?> <?php $i++; ?> <?php echo '" title="'; ?> <?php the_title(); ?> <?php echo '">'; the_title(); echo '</a></li>'; ?> <?php endwhile;
I wish to add the variable $i to the li class so I get different class for each li, or really any other variable that will help me style each one of them differently.
How can I do that?
I tried so many variations so far….
- The topic ‘Custom class for my li’ is closed to new replies.