Title: Making this php function random
Last modified: August 18, 2016

---

# Making this php function random

 *  [anabelle](https://wordpress.org/support/users/anabelle/)
 * (@anabelle)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/making-this-php-function-random/)
 * Hi, this function, is from the wp_random quote plugin, it outputs a list of all
   quotes, ordered by id. How can i make it to output the list in a randm order…
 * i know this is a minor code change but i can’t remember how it’s done.
 * here is the function:
 * `function wp_quotes_page($data)
    { $start = strpos($data, WP_QUOTES_PAGE);
 *  if ( $start !== false )
    { ob_start();
 *  global $wpdb;
 *  $sql = "select * from " . WP_QUOTES_TABLE;
 *  $result = $wpdb->get_results($sql);
 *  if ( !empty($result) )
    { $count = 0; foreach ( $result as $row ) { if ( $count
   ++ > 0 ) echo "<hr class=\"wp_quotepage_hr\">n";
 *  wp_quotes_spew($row, 'class="wp_quotepage"', 'wp_quotepage_quote', 'wp_quotepage_author');
 *  }
    } echo "<div class=\"wpquotes_poweredby\">Powered by <a href=\"[http://www.zombierobot.com/](http://www.zombierobot.com/)\"
   >Zombie Robot wp-quotes plugin</a>.</div>n";
 *  $contents = ob_get_contents();
    ob_end_clean();
 *  $data = substr_replace($data, $contents, $start, strlen(WP_QUOTES_PAGE));
    }
 *  return $data;
    } add_filter('the_content', 'wp_quotes_page', 10); ?>
 * Thanx

Viewing 1 replies (of 1 total)

 *  Thread Starter [anabelle](https://wordpress.org/support/users/anabelle/)
 * (@anabelle)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/making-this-php-function-random/#post-465671)
 * is it that hard?

Viewing 1 replies (of 1 total)

The topic ‘Making this php function random’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [anabelle](https://wordpress.org/support/users/anabelle/)
 * Last activity: [19 years, 7 months ago](https://wordpress.org/support/topic/making-this-php-function-random/#post-465671)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
