以下是我将如何做的一般结构:
$categories = array(5,2,4,3,1); //manually enter the array of the category ids in the order how you want them to appear
foreach( $categories as $cat ) {
$args = array(
\'category__in\' => array( $cat ),
\'posts_per_page\' => -1
);
$cat_query = new WP_Query( $args );
if( $cat_query->have_posts() ) : while( $cat_query->have_posts() ) : $cat_query->the_post();
//enter here, whatever you want to show per post//
endwhile;
endif;
} //end of foreach