ap_sort_array_by_order( array $arr )
Description #
Sort array by order value. Group array which have same order number and then sort them.
Parameters #
- $arrarray (Required) Array to order.
Source #
File: includes/functions.php
function ap_sort_array_by_order( $arr ) { $new_array = array(); if ( ! empty( $arr ) && is_array( $arr ) ) { $i = 1; foreach ( $arr as $k => $a ) { if ( is_array( $a ) ) { $arr[ $k ]['order'] = isset( $a['order'] ) ? $a['order'] : $i; } $i += 2; } $util = new WP_List_Util( $arr ); return $util->sort( 'order', 'ASC', true ); } }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:662
Add your comment