I have 3 loops each returning a taxonomy with different types , (client wants the ability to change text in a jQuery slideshow without coding). Can I integrate all 3 into 1 loop that queries the database for 3 separate types, returning posts in an unordered list like below, or am I stuck with using a loop for each type?
<ul class="sub-header-excerpts">
<li>
<?php
$args = array( 'excerpts_textboxes' => 'Excerpt One', 'posts_per_page' => 1);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<span class="textbox-title"><a href="#"><?php the_title(); ?></a></span>
<span class="textbox-excerpt"><a href="#"><?php the_excerpt(); ?></a></span>
<?php endwhile; ?>
</li>
<li>
<?php
$args = array( 'excerpts_textboxes' => 'Excerpt Two', 'posts_per_page' => 1);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<span class="textbox-title"><a href="#"><?php the_title(); ?></a></span>
<span class="textbox-excerpt"><a href="#"><?php the_excerpt(); ?></a></span>
<?php endwhile; ?>
</li>
<li>
<?php
$args = array( 'excerpts_textboxes' => 'Excerpt Three', 'posts_per_page' => 1);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<span class="textbox-title"><a href="#"><?php the_title(); ?></a></span>
<span class="textbox-excerpt"><a href="#"><?php the_excerpt(); ?></a></span>
<?php endwhile; ?>
</li>
</ul>
Edit:
$args = array(
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'excerpts_textboxes',
'field' => 'slug',
'terms' => array( 'Excerpt one', 'Excerpt Two', 'Excerpt Three' )
),
)
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
It does mention selecting multiple taxamonies:
I never tried querying multiple taxamonies at once, but I do rember it’s a bitch