Advertisements

sort_menu

Definition:
function sort_menu($a, $b) {}

Parameters

  • $a
  • $b

Source code

	function sort_menu($a, $b) {

		global $menu_order, $default_menu_order;

		$a = $a[2];

		$b = $b[2];

		if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) {

			return -1;

		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {

			return 1;

		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {

			if ( $menu_order[$a] == $menu_order[$b] )

				return 0;

			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;

		} else {

			return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1;

		}

	}

10307

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: