WP_MS_Themes_List_Table::_order_callback() WordPress Method

The WP_MS_Themes_List_Table::_order_callback() method is used to sort the list of themes by name, author, or rating.

WP_MS_Themes_List_Table::_order_callback( array $theme_a, array $theme_b ) #


Parameters

$theme_a

(array)(Required)

$theme_b

(array)(Required)


Top ↑

Return

(int)


Top ↑

Source

File: wp-admin/includes/class-wp-ms-themes-list-table.php

	public function _order_callback( $theme_a, $theme_b ) {
		global $orderby, $order;

		$a = $theme_a[ $orderby ];
		$b = $theme_b[ $orderby ];

		if ( $a === $b ) {
			return 0;
		}

		if ( 'DESC' === $order ) {
			return ( $a < $b ) ? 1 : -1;
		} else {
			return ( $a < $b ) ? -1 : 1;
		}
	}

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.