Return to Snippet

Revision: 36071
at November 17, 2010 14:40 by wpCanyon


Initial Code
function randomPosts($numPosts = 5){

	query_posts(array('orderby' => 'rand', 'showposts' => $numPosts));
	?> <ul> <?php
	if (have_posts()) : while (have_posts()) : the_post();

	?>
			<li><a title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

		<?php

	endwhile;

	?> </ul> <?php

	endif;

	wp_reset_query();

}

Initial URL
http://wpcanyon.com/tipsandtricks/showing-random-posts-in-wordpress/

Initial Description


Initial Title
Showing Random Posts In WordPress

Initial Tags
wordpress

Initial Language
PHP