Hi
You could use
<?php query_posts('category=whatever&showposts=5&offset=0&orderby=rand'); ?>
and that should work.
Thanks for getting back to me bioshox but I’m not a developer at all and don’t really know how to implement this.
I found a chunk of code in the blog page template that included the query_posts phrase but it was this:
<?php $cat_query = '';
if ( !empty($blog_cats) ) $cat_query = '&cat=' . implode(",", $blog_cats);
else echo '<!-- blog category is not selected -->'; ?>
<?php
$et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
?>
<?php query_posts("showposts=$et_ptemplate_blog_perpage&paged=" . $et_paged . $cat_query); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Can you advise on how I could incorporate your suggestion into this at all?
To confirm, I want the posts to display in random order for posts in all categories except one (and there are many!) so was looking to use the conditional tag such as !in_category( '14' )
Does that make sense?
many thanks again for your help
Kevin
Hi Kevin,
try the following
<?php $cat_query = '';
if ( !empty($blog_cats) ) $cat_query = '&cat=' . implode(",", $blog_cats);
else echo '<!-- blog category is not selected -->'; ?>
<?php
$et_paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
?>
<?php query_posts("showposts=$et_ptemplate_blog_perpage&paged=" . $et_paged . $cat_query."&orderby=rand"; ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Hi bioshox
I’m afraid that didn’t work – posts are still being displayed by date rather than randomly.
have you any other ideas on this at all?
many thanks
Kevin
Strange.
You may need to change your loop, this thread may be of use:
http://wordpress.org/support/topic/recent-posts-random-order?replies=6