0

The slider requires an unique ID per slide, wrapped in <li> tags, so I am trying this:

<div id="rev_slider_15_1" class="rev_slider fullwidthabanner" style="display:none;" data-version="5.2.5.4">
<ul>

    <!-- SLIDES -->

    {% for testimonials in craft.entries.section('testimonials').limit(3) %} 

    <li data-index="rs-{{ testimonials.id }}" >

        <!-- LAYERS -->

        <!-- LAYER NR. 1 -->

        <p class="tp-caption tp-resizeme" 
           id="slide-{{ testimonials.id }}-layer-2">

            {{ testimonials.body_testimonial }}

        </p>

        <!-- LAYER NR. 2 -->

        <span class="tp-caption tp-resizeme author" 
              id="slide-{{ testimonials.id }}-layer-3" >

            {{ testimonials.title }}

        </span>

    </li>

    {% endfor %}    

</ul>
</div>

This results in the first slide entry with both Title & Body, but the second and third slides only parse the Title not the Body.

Could someone verify the craft code is correct? The entries are made in a Channel section with a handle; testimonials.

3

Yes, your code looks fine.

It's possible that the second and third entries just don't have content in the body_testimonial field.

(Unrelated — I recommend using testimonial as your loop variable, since it represents a single Testimonial entry. This is a good practice in general: Variables that represent a list should have a plural name, and variables that represent a single object should have a singular name.)

1
  • Thanks Michael, that's embarrassing but during the cause of learning I would have wiped the entry body. Working fine now and appreciate pointing out the valid argument to use singular grammar. – Nutmeg Oct 7 '16 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.