http://php.net/manual/ja/function.array-multisort.php
//フォーチ 連多次元想配列 並び替え--------- //ソート用の配列を下準備 $amounts = array(); foreach($dterms2 as $key): $amounts[] = $key -> name; //$amounts[] = $key['name']; endforeach; // echo " <pre>"; // print_r($amounts); // echo "</pre> "; // 連多次元想配列 並び替え array_multisort($amounts, SORT_ASC, SORT_STRING, $dterms2); // echo " <pre>"; // print_r($dterms2); // echo "</pre> ";
https://www.stingmuzik.com/%E5%9C%B0%E5%9F%9F%E3%81%8B%E3%82%89%E6%8E%A2%E3%81%99
このページでは
ダブルで並び替えた
//親のIDをget_termsへ $args = array('hide_empty' => false, 'childless' => true); //子ターム一覧を取得 $dterms=get_terms('artist_chiiki',$args); //print_r($dterms) //フォーチ 連多次元想配列 並び替え--------- //ソート用の配列を下準備 $amounts = array(); $amounts2 = array(); foreach($dterms as $key): $amounts[] = $key -> parent; $amounts2[] = $key -> term_order; //$amounts[] = $key['name']; endforeach; // echo "<pre>"; // print_r($amounts); // echo "</pre>"; // 連多次元想配列 並び替え array_multisort($amounts, SORT_ASC, SORT_NUMERIC,$amounts2, SORT_ASC, SORT_NUMERIC,$dterms); // echo "<pre>"; // print_r($dterms); // echo "</pre>";