我有一个帖子类型,包括(1)位置和(2)一周中的一天的分类。
我使用第一种分类法将帖子分为多个组。下面是我使用的循环:
<?php
$terms = get_terms(\'cell-locations\');
$argv = array(
\'orderby\' => \'by_term\',
\'hide_empty\' => false
);
foreach ($terms as $term) {
$wpq = array (\'taxonomy\'=>\'cell-locations\',\'term\'=>$term->slug);
$myquery = new WP_Query ($wpq);
$article_count = $myquery->post_count;
echo \'<div class="accordionButton">\';
echo "<h2 class=\\"cellHeader\\" id=\\"".$term->slug."\\">";
echo $term->name;
echo "</h2>";
echo \'</div>\';
echo \'<div class="accordionContent">\';
if ($article_count) {
echo "<ul class=\'cell_list\'>";
while ($myquery->have_posts()) : $myquery->the_post();?>
<li class="cell-item">
<ul class="cell-list">
<li><?php $terms_as_text = get_the_term_list( $post->ID, \'cell-days\', \'\', \', \', \'\' ) ;
echo strip_tags($terms_as_text);
?> </li>
<li> <? echo get_post_meta(get_the_ID(), \'_cell_leader\', true); ?> / <?php echo get_post_meta(get_the_ID(), \'_cell_apprentice\', true)?></li>
<li>Get in touch with <a href="mailto:<?php echo get_post_meta(get_the_ID(), \'_cell_leader_email\', true);?>"><?php echo get_post_meta(get_the_ID(), \'_cell_leader\', true);?></a></li>
</ul>
</li>
<?php endwhile;
echo "</ul>";
}
echo \'</div>\';
}
?>
这为我提供了一个基于分类术语“细胞位置”的手风琴式布局这一切都很好,只是我现在想根据其他分类法“cells days”对每个位置内的帖子进行排序我用插件给他们排序(http://wordpress.org/extend/plugins/taxonomy-terms-order/).插件的api提供以下查询参数来按顺序调用帖子: $argv = array(
\'orderby\' => \'term_order\',
\'hide_empty\' => false
);
get_terms(\'category\', $argv);
在第一个循环中创建第二个循环时遇到问题。有什么想法或建议吗?