WP_Theme::sort_by_name
Sorts themes by name.
Method of the class: WP_Theme{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WP_Theme::sort_by_name( $themes );
- $themes(WP_Theme[]) (required) (passed by reference — &)
- Array of theme objects to sort (passed by reference).
Changelog
| Since 3.4.0 | Introduced. |
WP_Theme::sort_by_name() WP Theme::sort by name code WP 6.9.1
public static function sort_by_name( &$themes ) {
if ( str_starts_with( get_user_locale(), 'en_' ) ) {
uasort( $themes, array( 'WP_Theme', '_name_sort' ) );
} else {
foreach ( $themes as $key => $theme ) {
$theme->translate_header( 'Name', $theme->headers['Name'] );
}
uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) );
}
}