Are you using the category slugs?
Than that’s what you are doing wrong. You need to use the slugs.
ah that’s why … I will try now
thanks !
It still doesn’t work
Do I should to replace category_name bu category_slug ???
http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters
afaik, ‘category_name’ only takes one category slug;
for more than one category, try to use category IDs with ‘cat’ or ‘category__in’
Thanks Mr Alchymyth
I haven’t posted this issued until I searched all the night about this problem …
I don’t rush to post here whenever I have some problem ….
I have arleady tried “cat_id” as : cat_id => ‘(5,6)’
I ve tried different options …
afaik, ‘category_name’ only takes one category slug
You can use $query = new WP_Query( 'category_name=staff,news' );
.
I have arleady been using this code :
<?php
$fPosts = new WP_Query( array(
'offset' => 1,
'posts_per_page' => 3,
'category_slug' => '(proverbs,jokes)',
'post__in' => get_option("sticky_posts"),
'ignore_sticky_posts' => 1,
));
?>
<?php if ( $fPosts->have_posts() ) : ?>
/* etc .... */
So can I replace “‘category_slug’ => ‘(proverbs,jokes)'” with : ‘category_name=staff,news’ …. ????
OK
I will try to use this …
‘category__in’ => array( 2, 6 )
may be it will work
<?php
$fPosts = new WP_Query( array(
'offset' => 1,
'posts_per_page' => 3,
'category_name' => 'cat1,cat2',
'post__in' => get_option("sticky_posts"),
'ignore_sticky_posts' => 1,
));
?>
EDITED
cat1,cat2) or (cat1,cat2) ??
'category_name' => 'cat1,cat2',
It still doesn’t work my friend …
This has worked for me :
‘category__in’ => array( 10,14 ),
Add it to your information …
thanks a lot for your efforts !
Can I use this with just one category …
I wanna use ID numbers to avoid blank spaces in category names!