Thread: Wordpress help
View Single Post
Old 08-06-2007, 12:51 PM  
Andiz
Confirmed User
 
Andiz's Avatar
 
Join Date: Feb 2006
Posts: 2,594
Try this out on your index.php file

Quote:
<?php
global $wpdb;
$numposts = 10;

$rand_posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY RAND() LIMIT $numposts");
foreach($rand_posts as $post) :
setup_postdata($post);
?>

Template tags and what not go here

<?php endforeach; ?>
Just change the value of $numposts to define how many posts to query for.
Andiz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote