Build a Testimonial Widget for MODx using getResources

If you're in business, you know one the best ways to gain trust with your visitor  is to let your happy customers share their experience (hopefully positive).

What we'll need



I'll assume you have MODx installed, ready to go, most likely already in production.

First, let's create a container for your testimonials, start by making a resource in your web root, then create a child resource.

Testimonial Resource

You'll only need to worry about two fields:

Displaying the Testimonials

We'll start with the snippet call.

[[!getResources? &parents=`29` &tpl=`list-testimonials-tpl` &limit=`1` &includeContent=`1` &depth=`0` &sortby=`RAND()` ]]

&parents  = the container ID
&tpl = chunk used  for each testimonial
&limit =  ony show one, change to 2 and see what happens 
&sortBy = Sort them randomly 

The Chunk

Goto your elements tab in MODx and create a chunk and name it "list-testimonials-tpl". Use the content below.

<div class="testimonial">
<div class="testimonial-content"></div>
</div> <!-- eof item -->

Making it work

Enjoy and post comments below.



Recent Posts

OG Image Branding with phpThumb and MODX

Some of our clients have wanted to make sure their logo and branding appear in facebook, twitter, or messaging apps when shared. We came up with a clever solution.

Photography for the web

Did someone send you this link? First: Know that it is meant only as a guide. It's not that you can't shoot great photos, this is just to help you capture the best photography possible to be used in marketing. Photos…

Caller – "Hi I'd like to help you update your Google listing"

Heard this before? Yeah me too. at least once a month a nice friendly voice claiming to be from Google calls me wanting help me update my Google listing.