• Resolved twentyfourdegrees

    (@twentyfourdegrees)


    Hello everyone,

    I’m having a strange issue with tooltips I want to add to to a Bootstrap Carousel I’ve translated to PHP. Thing is, while in a loop, I want to add a tooltip of every post to the Carousel Indicators. I use the following code for that:

    <?php for($i = 0; $i < $count ;  $i++) { ?>
    <li data-target="#introCarousel" data-slide-to="<?php echo $i; ?>" class="text-center <?php echo ($i == 0) ? 'active' : ''?>" data-toggle="tooltip" title="<?php echo get_the_title(); ?>">
                                        <?php echo $i + 1; ?>
                                    </li>
                                <?php } ?>

    Even when I change:

    title="<?php echo get_the_title(); ?>"

    to

    title="<?php echo get_the_title($i); ?>"

    it always repeats the code of the first post found. Whatever I try, it’s always repeating the title from the first post found.

    What am I overlooking?

    Thanks for you help.

    kind regards.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Getting post titles while in a loop’ is closed to new replies.