You might need to paste the complete contents of index.php in at wordpress.pastebin.ca and report the link back here.
In the meantime, http://ww.wp.xz.cn/search/display+random+posts?forums=1
Or, via a magical 2 seconds with google, you could always go straight to the Random Posts plugin. 😉
Alternately you could try The Randomizer Plugin.
The Randomizer
I need to display a random post from a particular category on a page not in the loop, is this possible?
Can you point me in the right direction please
The page is in the theme root and is basically a static (home)page with a latest posts item which works fine, what I need to do is have a random post appear from a particular category (i.e. a random testimonial exerpt)
Thanks in advance
check the wordpress docs, theres lots of ways to do it.
You would need to edit your static page so have something like this…
<?php $yourquery = new WP_Query();
$yourquery->posts(‘cat=(whatever number category youre using)&order=RAND’);
while($yourquery->have_posts()) : $yourquery->the_post(); setup_postdata($yourquery); ?>
DO SOMETHING HERE
<?php endwhile; ?>
Thank you for that
I’m still a bit lost as I get an undefined call to function error.
Fatal error: Call to undefined function: posts() in /home/sites/public_html/wp-content/themes/wpremix/tpl_Home1.php on line 29
I’m using WP2.5.1, and have spent hours reading the docs but its a bit above me to be honest.
I’d appreciate a simple fix but I’m sure its not that easy
Thanks in advance