【发布时间】:2017-02-18 17:39:44
【问题描述】:
我有一个名为“部门”的自定义帖子类型和另一个名为“挑战”的帖子类型。挑战帖子类型有一个名为“部门类型”的分类法 - 与部门名称相同。
我创建了一个名为“single-sector.php”的页面,在该页面上显示一个包含与该部门相关的挑战的循环。
当我编写用于显示挑战的循环时,如何将 'sectortype' => 'advanced-education' 设为变量,以便它可以在其他单扇区页面上工作?
这就是我的循环...
<?php $challenge_args = array(
'post_type' => 'challenge',
'sectortype' => 'advanced-education', //Need Help Here
);
// create a new instance of WP_Query
$challenge_query = new WP_Query( $challenge_args );
?>
<?php if ( $challenge_query->have_posts() ) : while ($challenge_query->have_posts() ) : $challenge_query->the_post(); // run the loop ?>
【问题讨论】: