WP_Query by Custom Post_type and Multiple Custom Taxonomy values

Alan Ashbaugh 19th of April 2012

<?php $loop = new WP_Query( array( 
    'post_type' => 'team-members',
    'showposts' => -1,
    'tax_query' => array(
       'relation' => 'AND',
        array(
            'taxonomy' => 'department',
            'terms' => 'executives',
            'field' => 'slug'
        ),
        array(
            'taxonomy' => 'city',
            'terms' => 'portland',
            'field' => 'slug'
        )
    ),
    'orderby' => 'title',
    'order' => 'ASC' ) ); ?>

	<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

			<h3><?php the_title() ?></h3>
			<?php the_content(); ?>

	<?php endwhile; ?>
168
Views
0
Comments
0
Downloads
Comments
Only Code Pad members can post comments!

Want to join Code Pad Request An Invite
    No Comments Posted

Suppo - Create, Customize & Host
Your App Support Page at Suppo

Snippet Details

Keyboard Shortcuts

DDownload

TTweet

FFull View

Next Snippet

Previous Snippet