function wp_random_posts($number = 10) { $random_posts = wp_get_random_posts($number); foreach ($random_posts as $random_post) { $output .= '<li>'; $output .= '<a href="' . get_permalink($random_post->ID) . '" title="' . esc_attr(wptexturize($random_post->post_title)) . '">' . wptexturize($random_post->post_title) . '</a></li>'; } $output = '<ul class="randome_post">' . $output . '</ul>'; echo $output; }
function wp_random_posts($number = 3) { $limitclause = "LIMIT " . $number; $random_posts = wp_get_random_posts($limitclause); foreach ($random_posts as $random_post) { $output .= '<li>'; $output .= '<a href="' . get_permalink($random_post->ID) . '" title="' . wptexturize($random_post->post_title) . '">' . wptexturize($random_post->post_title) . '</a></li>'; } $output = '<ul class="randome_post">' . $output . '</ul>'; echo $output; }