Exlude Category from Custom Taxonomy from query Post loop
-
Hello,
I created a custom post type called Team, and a custom taxononomy with the slug name called
department
. This ìs the last line in register taxonomy() function:'rewrite' => array('slug' => 'department' )
in my template.php file, I have created a query to show the Senior Management. Here is my code:
<?php // args $args = array( 'post_type' => 'team', 'orderby'=> 'meta_value', 'department'=>'senior-management', 'meta_key' => 'cf_team_lastname', 'order' => 'DESC', 'showposts' => 100 ); $the_query = new WP_Query( $args ); ?>
This works fine…but now I want to show all the other departments in one list, and NOT senior management…how do I do that. Is there a simple way to NOT include the category
senior management
. I tried putting a MINUS in frontsenior management
ID, it did not work, as below:<?php // args $args2 = array( 'post_type' => 'team', 'orderby'=> 'meta_value', 'department'=>'-151', 'meta_key' => 'cf_team_lastname', 'order' => 'DESC', 'showposts' => 100 ); // get results $the_query = new WP_Query( $args2 ); // The Loop ?>
Any help would be great!
Thanks,
JC
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Exlude Category from Custom Taxonomy from query Post loop’ is closed to new replies.