カテゴリを使用してキャンプ旅行と募金活動を分離していると思いますが、この方法は、旅行/募金活動を分離する他の方法に近いはずです。また、これをループの外で、または 2 次ループとして実行することも想定しています。私はこれをテストしていませんが、このようなものがうまくいくはずです。
基本的にここに何をしようとしていたかです:
1) 募金活動とキャンプ旅行の両方を日付順にクエリします。
2) 2 つのクエリをマージして、募金活動が最初で、キャンプ旅行が 2 番目になるようにします。
3) 返された各投稿をループし、好きなように情報をマークアップします。
コード:
<?php //Enter your information for each variable:
$post_type = 'enter_your_custom_post_type_slug';
$fundraiserCatID = 'enter_your_fundaiser_category_id';
$campingCatID = 'enter_your_camping_category_id';
$acfDateFieldName = 'enter_your_date_acf_field_slug';
//Setup each Query args
$fundraiserAgrs = array('post_type' => $post_type, 'cat' => $fundraiserCatID, 'orderby' => 'meta_value', 'meta_key' => $acfDateFieldName, 'order' => 'ASC');
$campingAgrs = array('post_type' => $post_type, 'cat' => $fundraiserCatID, 'orderby' => 'meta_value', 'meta_key' => $acfDateFieldName, 'order' => 'ASC');
$fundraisers = get_posts($fundraiserArgs);
$campingTrips = get_posts($campingArgs);
$events = array_push($fundraisers, $campingTrips); //merge the two queries, with fundraisers first, then camping trips
if($events) : foreach($events as $event): //If we have $events, loop through each event
//Do what you will with the $event content ?>
<h1><?php echo $event->post_title; ?></h1>
<?php echo $event->post_content; ?>
<h6>Date: <?php the_field($acfDateFieldName, $event->ID); ?></h6>
<?php endforeach; endif; //End the loop and the conditional ?>