自定义帖子类型为“projects”,分级分类为“projects\\u category”
projects - big-corporates -- company one ---- first project 1 ---- second project 1 ---- third project 1 -- company two ---- first project 2 ---- second project 2 -- company three ---- first project 3 ---- second project 3 ---- third project 3 - small-businesses -- company four ---- first project 4 ---- etc... -- company five -- company six下面是“大公司”下“projects\\u category”中列出的所有项目的列表,而我想将列表限制为“大公司”每个子类别中的一个项目。
<?php
global $post;
$args = array( \'post_type\' => \'projects\', \'projects_category\' => \'big-corporates\' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php #the_title(); ?><?php $terms = get_the_term_list( $post->ID, \'projects_category\' ); $terms = strip_tags( $terms ); echo $terms; ?></a></li>
<?php endforeach; ?>
我正试图获得如下列表:company one (links to first project 1) company two (links to first project 2) company three (links to first project 3)我该怎么做?