Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

here is the request : get all post from category=11 (get 21 post), and then in the 21 post got from this category, refilter it, and show only post from category=10. So the request should be : cat=11&10. i what post that are from BOTH category at the same time, because my category are job and active. i what the listing of all the job, and then show just the one that are ative in the system !

$$mycat = "11&10" 
$showPostsInCategory->query('cat='. $mycat.'&posts_per_page=-1');
share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Have you looked up the WP Codex on WP_Query for categories?

They provide an example here. Also your category variable should probably only have one $. The way you've written your custom query also looks wrong, are you using WP_Query?

$query = new WP_Query( array( 'category__and' => array( 2, 6 ) ) );

share|improve this answer
add comment

for what it worth.. this is the final working code

$categories = "11&10";
$showPostsInCategory->query('category__and='. $categories.'&posts_per_page=-1');
share|improve this answer
    
Please explain your code, rather than just post it. –  s_ha_dum Jun 26 '13 at 2:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.