Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

Woothemes Testimonial - Filter query - Random order

By: DesignerEthan on Jun 30th, 2013  |  syntax: PHP  |  size: 0.91 KB  |  views: 220  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Wootheme Testimonial editing the testimonial query to order by rand.
  2. Can be expanded in various ways using standard wordpress query parameters.
  3. Place this code in your functions.php file. */
  4.  
  5. add_filter('woothemes_testimonials_args', 'random_order');
  6. function random_order() {
  7.  
  8.     $defaults = array(
  9.         'limit' => 5,
  10.         'orderby' => 'rand',
  11.         'id' => 0,
  12.         'display_author' => true,
  13.         'display_avatar' => true,
  14.         'display_url' => true,
  15.         'effect' => 'fade', // Options: 'fade', 'none'
  16.         'pagination' => false,
  17.         'echo' => true,
  18.         'size' => 50,
  19.         'title' => '',
  20.         'before' => '<div class="widget widget_woothemes_testimonials">',
  21.         'after' => '</div>',
  22.         'before_title' => '<h2>',
  23.         'after_title' => '</h2>',
  24.         'category' => 0
  25.     );
  26.  
  27.     $args = wp_parse_args( $args, $defaults );
  28.  
  29.     return $args;
  30. }