您很可能可以重用该循环并运行两次。第一次显示查询的帖子,第二次显示其余帖子
// Get the current post id being viewed
$current_post_id = get_queried_object_id();
// Define your query and query arguments
$args = [
// All your arguments
];
$q = new WP_Query( $args );
if ( $q->have_posts() ) {
// Run the loop for the first time to display the post equal to the queried one
while ( $q->have_posts() ) {
$q->the_post();
if ( get_the_ID() == $current_post_id ) {
// Display the post equal to the queried one
}
} // endwhile
// Rewind the loop so that we can run it again
$q->rewind_posts();
// Run the loop for the second time to display all the other posts
while ( $q->have_posts() ) {
$q->the_post();
if ( get_the_ID() != $current_post_id ) {
// Display all the other posts skipping the queried one
}
} // endwhile
// Clean after ourselves, good housekeeping
wp_reset_postdata();
} // endif