WP_Theme::sort_by_name() WordPress Method

WP_Theme::sort_by_name() is a method for sorting themes by name. It takes an array of themes and sorts them alphabetically by name.

WP_Theme::sort_by_name( WP_Theme[] $themes ) #

Sorts themes by name.


Parameters

$themes

(WP_Theme[])(Required)Array of theme objects to sort (passed by reference).


Top ↑

Source

File: wp-includes/class-wp-theme.php

	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' ) );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.