On this page
WP_Theme::sort_by_name( WP_Theme[] $themes )
Sorts themes by name.
Parameters
$themesWP_Theme[] Required-
Array of theme objects to sort (passed by reference).
Source
File: wp-includes/class-wp-theme.php. View all references
public static function sort_by_name( &$themes ) {
if ( 0 === strpos( 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' ) );
}
}
Related
Uses
| Uses | Description |
|---|---|
| get_user_locale() wp-includes/l10n.php | Retrieves the locale of a user. |
Used By
| Used By | Description |
|---|---|
| wp_prepare_themes_for_js() wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| WP_MS_Themes_List_Table::prepare_items() wp-admin/includes/class-wp-ms-themes-list-table.php | |
| WP_Themes_List_Table::prepare_items() wp-admin/includes/class-wp-themes-list-table.php |
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme/sort_by_name