Skip to documentation content

Testimonial Slider

All complete examples

Demonstrate Testimonial Slider.

What this example teaches

  • Implement the Testimonial Slider section with its owned custom fields
  • Keep custom fields on the template that owns them

View this pattern on the live demo site

Files

Rotating quotes from the testimonials datastore.

Liquid
{% comment %}
	Displays the selected testimonials as a slider
	Inputs:
		section_class
		section_id
		
	Custom Fields:
		show_testimonials
		testimonials_slider_count
		testimonials

	Outputs:
		section_rendered - true when this section outputs markup, false otherwise
{% endcomment -%}
{%- if entity.show_testimonials.on -%}
	<section{% if section_class %} class="{{ section_class }}"{% endif %}{% if section_id %} id="{{ section_id }}"{% endif %}>
		<div class="container">
			{%- var testimonial_on_dark_bg = false %}{% if section_class contains 'text-bg-dark' or section_class contains 'text-bg-secondary' %}{% set testimonial_on_dark_bg = true %}{% endif -%}
			{%- var headinglevel = headinglevel %}{% comment %}Copy to current scope{% endcomment -%}
			{%- include '/common/_title_with_subtitle.liquid' title:'What Our Customers Say' subtitle:'Neighbors, chefs, and ranch families who trust the Vaughn counter' title_classname:'text-center text-white' subtitle_classname:'text-center text-white opacity-75 mb-4' postincrement_headinglevel:true -%}
			{%- include "/partials/_testimonial_slider.liquid" testimonials:entity.testimonials testimonials_slider_count:entity.testimonials_slider_count testimonial_on_dark_bg:testimonial_on_dark_bg -%}
		</div>
	</section>
	{%- set section_rendered = true -%}
{%- else -%}
	{%- set section_rendered = false -%}
{%- endif -%}