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.

Hey i was wondering how could i show post from a certain taxonomy term in the loop.

 <?php the_excerpt(); ?>

I have a taxonomy entitled "series" under my post type entitled "Gallery", and in "series" i have the TERM "pretty-little-liars". Under my post type "pretty-litte-liars" archive it shows all the post posted in that CPT. I would like to add a code that also allows post posted under the taxonomy "series" with the term "pretty-little-liars" to show on that page as well.

what do i add to the above excerpt code to make this happen?

share|improve this question
add comment

1 Answer

Try this.

$type = 'buehne';  // Name of the Custom Post Types
$tag =  'TagName';


$args =  array(
        'post_type' => $type, 
        'paged' => $paged,
        'posts_per_page' => -1, 
        'orderby' => 'menu_order',
        'order' => 'ASC', 
                'tax_query'=>array(
                    array(
            'taxonomy'=>'th3', //name of the Taxonom 
            'field'=>'slug',
            'terms'=>array($tag)
                            ))
                    );



$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    if(is_object_in_term($post->ID,'th3','TagName')) {  
        the_title(); ";

    }
endwhile;
share|improve this answer
    
this looks complicated, where do i add this –  Terrell Anderson Aug 21 '12 at 15:42
    
You have to Query a new loop with the Parameters you like to output. Place this code in your Template. with the Line is_object_in_term() you can filter the output you want. You could search in the codex page for custom post types and for is_object_in_term –  user1606423 Aug 21 '12 at 15:54
add comment

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.