WordPress display random post

18.Aug.2010

You might want to use WordPress to display random post. In case you want to do so, just use following snippet:

1
2
3
4
5
$rand_post = get_posts('numberposts=1&orderby=rand');
 
$post = current($rand_post);
the_title();
the_content();