I found the way how to reorder already selected posts.
For exapmle, we have selected posts:
$qargs = array(
'posts_per_page' => 15,
'no_found_rows' => true,
'order' => 'DESC',
'post_type' => 'post',
'suppress_filters' => false,
'orderby' => 'post_views', // here I order my posts by views
'fields' => '',
'date_query' => array(
array(
'after' => '-7 days',
'column' => 'post_date',
),
),
$posts_query = new WP_Query( $qargs );
Now we can reorder these posts by date:
function order_by_date( $a, $b ) {
return strcasecmp( $b->post_date, $a->post_date );
}
usort( $posts_query->posts, 'order_by_date' );
And next, we can echo our posts:
if ( $posts_query->have_posts() ): ?>
while ( $posts_query->have_posts() ):
$posts_query->the_post();
.......