我有一个自定义的帖子类型“Production”,其中“Tourdates”作为repeaterfield(使用高级自定义字段插件)。Tourdates有一个“Date&;名为“Playdate”的“时间选择器”字段。
我现在想显示(在列表中)按时间顺序排列的所有作品的所有播放日期。
我当前的查询显示如下帖子:
2017年4月9日(生产x)2017年12月28日(生产y)2017年4月7日(生产x)2017年4月11日(生产x)2017年4月31日(生产y)但我希望将其显示如下:
2017年4月7日(生产x)
$args = array(
\'numberposts\' => -1,
\'post_status\' => \'publish\',
\'post_type\' => \'productie\',
\'suppress_filters\' => false,
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
$productienaam = get_the_title();
if( have_rows(\'tourdata\') ):
while ( have_rows(\'tourdata\') ) : the_row();
$speeldatum = get_sub_field(\'speeldatum\');
$the_ID = get_the_ID();
$productie[$speeldatum][$the_ID][\'speeldatum\'] = $speeldatum;
$productie[$speeldatum][$the_ID][\'name\'] = $productienaam;
endwhile;
endif;
endwhile;
endif;
// $speeldatum = date("Ymd");
asort($productie);
foreach ($productie as $key_day => $row_day){
if ($key_day > date("Ymd")) {
foreach ($row_day as $key_productie => $row_productie){
$productie_name = $row_productie[\'name\'];
$productie_date = $row_productie[\'speeldatum\'];
echo $productie_date .\' : \'. $productie_name .\'<br />\';
}
}}