'page' ";
$sql .= "ORDER BY RAND() LIMIT 15";
$randposts = $wpdb->get_results($sql);
$output = '';
$randli = "0";
foreach ($randposts as $randpost) {
$post_title = stripslashes($randpost->post_title);
$permalink = get_permalink($randpost->ID);
$randli = $randli+1;
$output .= '- ' . $post_title . '';
$output .= '
';
}
echo $output;
?>
新版WP用以下代码
'rand', 'showposts' => 15));
if (have_posts()) :
while (have_posts()) : the_post();?>