私は、次のように順序付けられた場所を持つカスタム投稿タイプの学校のセットを持っています:
London
- 1 Oxford Road
- 2 Cambridge Road
Paris
- 1 Napoleon Road
- 2 Tower Road
ロケーションの子の代わりにロケーションの親が出力されるように、以下を変更するにはどうすればよいですか。
// begin loop
$args = array('post_type' => 'school');
query_posts($args); if ( have_posts() ) : while ( have_posts() ) : the_post();
// variable for location
$location = get_the_term_list( $post->ID, 'location', '', ', ', '' );
// output
echo get_the_title() . ' - ' . $location;
// end loop
endwhile; endif;
ありがとうございました。