SimplePie::merge_items()public staticWP 1.0

Merge items from several feeds into one

If you're merging multiple feeds together, they need to all have dates for the items or else SimplePie will refuse to sort them.

Метод класса: SimplePie{}

Хуков нет.




$result = SimplePie::merge_items( $urls, $start, $end, $limit );
$urls(массив) (обязательный)
List of SimplePie feed objects to merge
Starting item
Number of items to return
Maximum number of items per feed

Код SimplePie::merge_items() WP 6.3.1

public static function merge_items($urls, $start = 0, $end = 0, $limit = 0)
	if (is_array($urls) && sizeof($urls) > 0)
		$items = array();
		foreach ($urls as $arg)
			if ($arg instanceof SimplePie)
				$items = array_merge($items, $arg->get_items(0, $limit));
				trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);

		usort($items, array(get_class($urls[0]), 'sort_items'));

		if ($end === 0)
			return array_slice($items, $start);

		return array_slice($items, $start, $end);

	trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
	return array();