Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I currently have the following code pulling the 10 latest posts from a specific category, I would like to filter those posts to a certain custom taxonomy which I've set up called article type.

What do I need to modify to incorporate this filter?

<div id="btcc" class="main-headline-box">          
<h2>Features</h2>        
<?php $btcc_query = new WP_Query('category_name=btcc&showposts=10'); ?><ul>
<?php while ($btcc_query->have_posts()) : $btcc_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>" title="Permanent Link to: 
<?php the_title_attribute(); ?>">
<?php the_title(); ?></a></li>
<?php endwhile; ?><li class="read-more"><a href="">Read more from the BTCC Archive</a></li></ul>
</div>
share|improve this question

1 Answer 1

up vote 1 down vote accepted

A simple search in codex shows how to do that :

$args = array(
'post_type' => 'post',
'tax_query' => array(
    array(
        'taxonomy' => 'people',
        'field' => 'slug',
        'terms' => 'bob'
    )
)
);
$query = new WP_Query( $args );

EDIT: do not use showposts, it's deprecated.

share|improve this answer
    
Perfect, thanks worked it out in the end using this solution also updated so query wasn't using showposts –  Vince Pettit Aug 1 '13 at 13:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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