I have the following code that its been dynamically generated by a plugin, the plugin will create a "li" element for each team member, currently i have 150 members so im adding an auto increment ID.
<?php $i = 0; ?>
<ul id="dvteamgrid<?php echo esc_attr($random); ?>" class="dvteamgrid withanim">
<li data-filter-class='["gridall",<?php echo $filters; ?>]' id="team-<?php echo ++$i; ?>">
The code is working properly adding team-1, team-2...and so on. My issue is that im frequently updating my list of members so if I add a new member between team-1 and team-2, the ID for team-2 will be team-3. I would like to keep same ID value even though I add new members.
Any suggestions? Thanks in advance.
Chose a unique id for each team. For instance the name of the team, or an md5 hash of the name of the team.
Auto increment only works if you never reuse the same index, which would guarantee that the index is a uid (unique id).