我想合并以下两个查询,以便在其他促销(查询2)之前显示正在进行的促销(查询1),但总共显示的结果不超过5个。谢谢
查询#1正在进行的促销
<?php
global $post;
$args = array(
\'post_type\' => \'promotions\',
\'numberposts\' => 5,
\'meta_key\' => \'sp_ongoingPromotion\',
\'meta_value\' => 1
);
$supplierCommunications = get_posts( $args );
foreach( $supplierCommunications as $post ) : setup_postdata($post);
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
<span>
<?php
echo "Ongoing Promotion";
?>
</span>
</li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
查询#2当前促销 <?php
global $post;
$args = array(
\'post_type\' => \'promotions\',
\'numberposts\' => 5,
\'meta_key\' => \'sp_endDate\',
\'meta_value\' => date("Y/m/d"),
\'meta_compare\' => \'>=\',
\'orderby\' => \'meta_value\',
\'order\' => \'ASC\'
);
$supplierCommunications = get_posts( $args );
foreach( $supplierCommunications as $post ) : setup_postdata($post);
?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<br/>
<span>
<?php
$meta = get_post_meta(get_the_ID(), \'sp_endDate\', true);
if(\'\' != $meta) {
$formattedDate = new DateTime($meta);
echo "Expires: ".$formattedDate->format(\'F d, Y\');
}
?>
</span>
</li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>