Quote:
Originally Posted by tonyparra
Thanks i did get it to work 
|
If you want to add a category clause to it.. you could add something like the following to the args array...
via category id:
PHP Code:
$args1 = array(
'cat' => 3,
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'offset' => 0
);
query_posts($args1);
of course, you could also just use the category name like so:
PHP Code:
$args1 = array(
'category_name' => 'cat_name_here',
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'offset' => 0
);
query_posts($args1);
or my favorite way, by category slug because I don't like using uppercase letters and/or spaces in my queries:
PHP Code:
$Obj = get_category_by_slug('cat_slug_here');
$catid = $Obj->term_id;
$args1 = array(
'cat' => $catid,
'posts_per_page' => 5,
'orderby' => 'rand',
'post_status' => 'publish',
'offset' => 0
);
query_posts($args1);