In my wordpress theme i have this code,
<?php query_posts(array('post__in' => get_option('sticky_posts'), 'post_status' => 'publish', 'orderby' => 'rand')); ?>
this is very slow, is there any faster way to do this.
In my wordpress theme i have this code,
<?php query_posts(array('post__in' => get_option('sticky_posts'), 'post_status' => 'publish', 'orderby' => 'rand')); ?>
this is very slow, is there any faster way to do this.
try this, add where you want show the random post:
<ul>
<li><h2>A random selection of my writing</h2>
<ul>
<?php
$rand_posts = get_posts('numberposts=5&orderby=rand');
foreach( $rand_posts as $post ) :
?>
<li><a>"><?php the_title(); ?></a></li>
<?php endforeach; ?>This topic has been closed to new replies.