Random order of posts on each request

I want my testimonials to be shuffled everytime someone clicks on my testimonials page so that it is not the same one on top all the time.

How can I do this? Where should I put the code?

I am building using Thesis for WordPress.

Also, i assume that each testimonial will need to be inside a div and I will give an ID to each div so that they can be shuffled?

I still want them all to be on the page, I just want the order they appear in to change.

Topic order theme-thesis Wordpress

Category Web


Use jQuery on your page to sort the divs.

Ideally you want your divs to all have the same CLASS so you can identify which divs to randomize.

I'm not familiar with the thesis theme but presumably there is a testimonials.php or something similar you could modify. If so, add your jQuery in there.

Here's someone else answering the same question:

https://stackoverflow.com/questions/1533910/randomize-a-sequence-of-div-elements-with-jquery

I hope that helps.

You should be able to put your jQuery at the bottom of the testimonials.php file. The only thing you'll have to change from the code in the link above is to insert the correct class name for your divs.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.