我有一组自定义帖子类型的学校,其位置如下:
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;
谢谢 .
1 回答
我没有测试以下脚本,但我希望它能为您带来解决方案的一步 .