好了,你就快到了。假设您有以下查询:
$argsLoop = array(
\'post_type\' => \'cars\',
\'posts_per_page\' => 12,
\'paged\' => 1,
\'meta_key\' => \'cars_price\',
\'orderby\' => \'cars_price\',
\'order\' => \'DESC\'
);
$cars = new WP_Query( $argsLoop );
// All you have to add is this line:
shuffle( $cars->posts );
现在,您可以执行标准循环,所选车辆将以随机顺序显示。