[resolved] Giving each post a different div id in the WordPress Loop (2 posts)

  1. mloberg
    Posted 6 years ago #

    I am listing out posts in div's and want each div to have a different id. So the first post would be <div id="post-1">The first post</div>, the second <div id="post-2">The second post</div>, etc. How would I do this?

  2. mloberg
    Posted 6 years ago #

    I figured out a way. I declared a variable and set it equal to 1, then at the end of each loop, I just added one to it.

Topic Closed

This topic has been closed to new replies.

About this Topic