【发布时间】:2011-06-27 14:21:36
【问题描述】:
我正在尝试遍历特定分类中的所有帖子,无论它们在哪个术语中(即,通过该分类中的所有术语)。
我有这个代码:
<?php
$terms = get_terms('business-books');
$booksArgs = 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] ?>&w=110&h=155&zc=1" alt="<? get_the_title() ?>" /></a>
<h6><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>
<?php endwhile; ?>
我需要$terms 来返回“商业书籍”中所有术语的数组。
有人可以帮我处理这个数组吗?
谢谢!
【问题讨论】: