Quote:
Originally Posted by nexcom28
I am wanting random posts from one category only
Looking to put this code in
Code:
query_posts(array(
'showposts' => 6,
'orderby' => 'rand',
'category_name' => 'News' //You can insert any category name
));
if (have_posts()) : while (have_posts()) : the_post();
or something similar.
Really I just want to randomise the posts from one category. I would use a pplugin but I can't find one, they all seem to be widgets.
|
if you have a home.php file, copy it and rename the copy to category.php. If you have no home.php file then copy index.php and rename the copy to category.php.
You would then need to strip out any existing query args from the new category.php file you created, and replace it with something like this:
Code:
query_posts($query_string."&showposts=6&orderby=rand")
I wouldn't recommend inserting the "'category_name' => 'News'" part because the category.php file is global and will cover any and all categories via "$query_string" in my example.