Home › Forums › Add-ons › Flexible Content Field › Unique ID, count flexible field? › Reply To: Unique ID, count flexible field?
Flexible content itself does not contain a unique ID. However, you can easily append one when outputting the flexible content. For example, if outputting your slider wrap it in a container such as:
<div id="slider-container-<?php echo $counter++; ?>" class="slider-wrapper">
Container content...
</div>
Define $counter
before your loop and set it to 1 or 0.
If you’re using jQuery you can also set the context for the selector so it does not apply it document-wide: http://api.jquery.com/jquery/#jQuery1
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.