Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #3667101
Testimonials
Closed

Comments

  • Roz started the conversation

    How can I get the testimonials to display in random orders? I just want a random selection that is different each time so users dont see the same first 4 or 5 every time


  •  7,120
    Oliver replied

    Hi Roz, 

    this setting is not available out-of-the-box, so custom code is needed:

    the js code responsible for testimonials is located in the file /wp-content/themes/thegem/js/testimonials-carousel.js

    To display the testimonials in a random order, you need to shuffle the elements before initializing the carousel. You can achieve this by modifying the jQuery code to shuffle the .gem-testimonial-item elements.

    You need to add the following code: 

    // Shuffle testimonials
    $testimonials.sort(function() {
    return 0.5 - Math.random();
    }).appendTo($testimonialsCarousel);

    here: 

    7321820652.png

    The only thing is that this change should be done via the child theme in order to avoid problems with the future theme updates (the file will be overwritten in the parent theme). I would suggest that you give a try to this code and if everything is working as expected - let me know so we can consider the way to isolate this customization via the child theme. 

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • Roz replied

    thank you, I will give this a try and I appreciate you giving me code to doit as I know it isn't part of normal support. 

    Please consider a "random" option as part of your testimonials setup in a upcoming release, it would  be super helpful to anyone that has a lot of reviews posted. 


  •  7,120
    Oliver replied

    Hi Roz, 

    will add this to the devs list, hopefully it will be covered in the next release.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver