-
AuthorPosts
-
September 2, 2024 at 11:11 am #1466033
On the front of the website I want the testimonials to be loaded randomly. Where can I adjust the query?
In the file itself I don’t see an “orderby” anywhere.September 3, 2024 at 4:59 am #1466080Hey Chris,
Thank you for the inquiry.
Are you using the slider format of the Testimonial element? If yes, then you can try this script in the functions.php file:
function ava_custom_script_randomize_testi() { ?> <script> (function ($) { function g() { var $testimonialRow = $('.avia-testimonial-row'); var $testimonials = $testimonialRow.find('.avia-testimonial'); $testimonials.sort(function () { return 0.5 - Math.random(); }); $testimonialRow.empty().append($testimonials); } $(document).ready(function () { g(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script_randomize_testi');Best regards,
IsmaelSeptember 3, 2024 at 10:29 am #1466102Hello Ismael,
Thanks for your response. Unfortunately it does not work on the slider that is used. In the testimonial slider we use the “Big testimonial slide”.
Attached is the link to the website and the required login details.Kind regards.
September 3, 2024 at 1:08 pm #1466121Hi,
Thank you for the update.
We edited the functions.php file and adjusted the script a bit. Please make sure to purge the cache before checking the page.
Best regards,
IsmaelSeptember 3, 2024 at 2:51 pm #1466130Works perfectly, thank you!
September 4, 2024 at 3:59 am #1466170 -
AuthorPosts
- The topic ‘Randomize testimonials’ is closed to new replies.
