你想要的natural order sorting,
实例
$val = array(5.1, 5.11, 5.12, 5.2, 5.21);
natsort($val);
foreach ($val as $key => $val) {
echo $val."<br>";
}
Produces:
5.1
5.2
5.11
5.12
5.21
其中,as;
$val = array(5.1, 5.11, 5.12, 5.2, 5.21);
asort($val);
foreach ($val as $key => $val) {
echo $val."<br>";
}
Produces:
5.1
5.11
5.12
5.2
5.21
溶液
$loop = new WP_Query(array(
\'factsheet_category\' => $term->slug,
\'orderby\' => \'meta_value meta_value_num\', //addition of meta_value before meta_value_num
\'meta_key\' => \'factsheet_id\',
\'order\' => \'ASC\'
));