get academic depts
// WP_Query arguments
$args = array(
'post_type' => array( 'departments' ),
'order' => 'ASC',
'orderby' => 'title',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'is_academic_department',
'value' => 'Yes',
'compare' => '=',
'type' => 'CHAR',
),
),
);
// The Query
$academic = new WP_Query( $args );
// The Loop
if ( $academic->have_posts() ) {
while ( $academic->have_posts() ) {
$academic->the_post();
// do something
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();