Standard Testimonial Carousel Slider - Conditional?

Hi There!

I’m using the Standard Testimonial Carousel Slider provided by Modern Sliders. I’d like to use a “master” JSON file that includes testimonials for the whole company, adding something like a “department” field to the JSON file, with either “Products” or “Services” as the descriptor.

Then, I’d like the slider to appear on each page, with only that department’s relevant testimonials appearing. Is this possible? I’m imagining there’s something in the conditions field I could enter so that only the “Products” testimonials show up on the page about our products, and the “Services” testimonials show up on the page about our services.

What settings would I use in the conditions, so that only the ones with
“department” : “Products”,
appear on the products page?

This would allow me to choose which slides appear on which pages, but I would only need to update the one JSON file when we get a new testimonial. Maybe this isn’t possible, or I’m taking the wrong approach?

Hello @capodanno,

Thanks for writing in!

Yes, that is possible. If your indicator is the page title, then you can use the following STRING condition:
{{dc:post:title}} IS {{dc:looper:field key="department"}} or vice versa, then you can display that particular Testimonial item.

We would love to check out your layout and your JSON so we can apply this condition.

Best Regards.

Sure! I have the example page ready for you. I’ll send you the details in a secure note.

Hello @capodanno,

If that is the case, your condition will be the following:

{{dc:looper:field key="department"}} IS department-name

image

You will have to use OR logic to display items that are from both departments.

Best Regards.

What element am I adding this condition to? I’ve tried the Slide but the entire thing disappears. (See screenshot where only the navigation remains)

I also tried adding the condition to the Slide Container and the entire slider, but those didn’t work.

I also realized I needed to make this a COMPONENT to be truly effective across multiple pages. (The goal is to update the JSON file at the “master template” and it will deploy everywhere. That’s what a component is for!) This complicates things, as now I need to set up a parameter, right? I’m sure that’s different than what we were originally trying to do, but I’d love to learn how to do both conditional slides appearing from a template, and parameter settings when this same slider is a component!

Definitely no idea where to begin to create a parameter that will only show slides from certain departments. I’ve watched the Youtube videos about components, but could learn from this specific example.

I have the component at the top of the page, and template toward the bottom.

Hello There,

You will have to add the condition to the Looper Consumer element. In this case, that would be the Slide element. Yes, it would be a good one to have as a Slider Component, so that you can update the JSON file and use it anywhere on the site.

When you apply the condition, it will no longer display, which is because of your condition. The Slide will only display on the page where the condition is met, especially if your condition is like:

{{dc:post:title}} IS {{dc:looper:field key="department"}}

From what I see, you do not need a parameter to implement this. At the moment, it may not work because the JSON has no relation or connection to the Cabin Services page. If I am the one who will implement this, I would change the JSON into this:

{
    "name"        : "Caz Marie Norwich",
    "title"       : "Vista",
    "department"  : "cabin-services",
    "testimonial" : "Deb is very thorough, has a ton of expertise and knowledge. So excited to get up in the air and use my training! This course exceeded my expectations, Deb is incredible!"
  }

And then my condition to be used in the slide would be this:

{{dc:looper:field key="department"}} IS {{dc:post:slug}}

This will display testimonial items that return the condition above to TRUE on pages like your “Cabin Services” page and the “Training” page. And if there are testimonial items that you want to display in all pages, you can have a condition like:

{{dc:looper:field key="department"}} IS {{dc:post:slug}}
OR
{{dc:looper:field key="department"}} IS all

Hope this helps.