I have a cookie in bootstrap
and to call wordpress posts inside it, I have for
inside <div class="carousel-inner">
.
The for
can create the posts, but I am not able to include the indicators of each post (the balls that are below the carousel or <ol class="carousel-indicators">
).
The structure of the indicators is:
<ol class="carousel-indicators">
<li data-target="#id_carousel" data-slide-to="0"></li>
</ol>
What I need is this data-slide-to
, because it is being set to 0 for each post that was created, ie regardless of which one I click, the carousel returns to the first post.
What I have:
<ol class="carousel-indicators">
<?php for ($i = 1; $i <= NUMBER_OF_SLIDES; $i++) : ?>
<li data-target="#carousel" data-slide-to="0" class="<?php echo ($i == 1) ? 'active' : ''; ?>"></li>
<?php endfor; ?>
</ol>
The <li>
are created within for
, but I am not able to assign a number other than data-slide-to
to every <li>
created.
What I'm trying to do is to make the output of this for
quit like this:
<li data-slide-to="0">
<li data-slide-to="1">
<li data-slide-to="2">
...