I am trying to get a unique Id for each iteration. I am able to get alternate id’s but would like to get a unique id for each so the 1st iteration would have an id=”first” 2nd id=”second” 3nd id=”third” and so on.
here is the code I have so far which gets me the alternate id’s.
but mainly I am only dealing with these lines:
<? $alt_post = 'alt-post';?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?$alt_post = $alt_post == 'alt-post' ? 'first' : 'second';?> <?php echo '<li class = "four-count"> <p id="'. $alt_post.'">'?>
Thanks for any help!
Note:First post so I’m not sure how this code is going to show up.
- The topic ‘Individual id's for each iteration’ is closed to new replies.