Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Are testimonials a custom post type? –  chrisguitarguy Oct 3 '12 at 23:25
    
Not familiar with Thesis, but are you using a custom post query on this page? If so, have you tried to set the orderby parameter to rand? –  Eric Allen Oct 4 '12 at 2:55
add comment

1 Answer

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:

http://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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.