开发者

WP_Query through all terms of a taxonomy

I'm trying to loop through all posts within a specific taxonomy, regardless of what term they're in (ie, through all terms in that taxonomy).

I have this code:

<?php 
    $terms = get_terms('business-books');
    $booksA开发者_开发百科rgs = array(
    'posts_per_page' => '1',
    'tax_query' => array(array(
            'taxonomy' => 'business-books',
            'field' => 'slug',
            'terms' => $terms
    ))
    ); $books = new WP_Query($booksArgs); while ($books->have_posts()) : $books->the_post(); $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full ); ?>
    <a href="<?php the_permalink(); ?>"><img src="<? echo get_bloginfo('template_directory'); ?>/timthumb.php?src=<? echo $thumbnail[0] ?>&amp;w=110&amp;h=155&amp;zc=1" alt="<? get_the_title() ?>" /></a>
    <h6><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>              
<?php endwhile; ?>

I need $terms to return an array of all the terms in 'business-books'.

Can someone aid me with this array?

Thank you!


Problem was that

$terms = get_terms('business-books');

needs to be

$terms = get_terms('business-books', 'fields=names');

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜