SimplePie::sort_items()public staticWP 1.0

Sorting callback for items

Method of the class: SimplePie{}

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

true|false.

Usage

$result = SimplePie::sort_items( $a, $b );
$a(SimplePie) (required)
-
$b(SimplePie) (required)
-

SimplePie::sort_items() code WP 6.5.2

public static function sort_items($a, $b)
{
	$a_date = $a->get_date('U');
	$b_date = $b->get_date('U');
	if ($a_date && $b_date) {
		return $a_date > $b_date ? -1 : 1;
	}
	// Sort items without dates to the top.
	if ($a_date) {
		return 1;
	}
	if ($b_date) {
		return -1;
	}
	return 0;
}