0

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');
1

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 ) ) );

| improve this answer | |
0

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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