Title: Template / add increment
Last modified: November 10, 2017

---

# Template / add increment

 *  [VanW](https://wordpress.org/support/users/vanw/)
 * (@vanw)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/template-add-increment/)
 * Hello,
    I am playing around with templates and when trying to add IDs somehow
   I cannot add increment option to it.
 * Basically I try:
 * global $post;
    while ( have_posts() ): the_post(); $i = 0; $lcp_display_output.
   = “<div id=”; $lcp_display_output .= $i++; $lcp_display_output .= ” class=’singletab’
   >”;
 * this gives same ID to every item.
 * I need the IDs to be predefined like:
    post1,post2,post3,post4. I also need to
   know the IDs ahead, so I can use them in CSS.
 * The idea is that I’ll have them appear also somewhere else and will use it as
   links (#post1, etc).
 * I’m sure solution will be something simple, just can’t see it.
 * Thank you in advance for your help.
 * Very powerful plugin, personally use it on most of my projects.
 * with regards
 * Van
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftemplate-add-increment%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  [aehwp](https://wordpress.org/support/users/aehwp/)
 * (@aehwp)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/template-add-increment/#post-9674468)
 * Your code looks as though it is resetting $i to 0 within the loop instead of 
   outside it.

Viewing 1 replies (of 1 total)

The topic ‘Template / add increment’ is closed to new replies.

 * ![](https://ps.w.org/list-category-posts/assets/icon-256x256.png?rev=2517221)
 * [List category posts](https://wordpress.org/plugins/list-category-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/list-category-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/list-category-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/list-category-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/list-category-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/list-category-posts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [aehwp](https://wordpress.org/support/users/aehwp/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/template-add-increment/#post-9674468)
 * Status: not resolved