Archived
Updates
This commit is contained in:
1 parent
70d2335bba
commit
7428b67da5
1086 files changed
+94145
-59082
No files matched your search
+26
-21
@@ -12,9 +12,6 @@
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @uses get_term
|
||||
* @uses get_term_by
|
||||
*
|
||||
* @param string $menu Menu ID, slug, or name.
|
||||
* @return mixed false if $menu param isn't supplied or term does not exist, menu object if successful.
|
||||
*/
|
||||
@@ -81,8 +78,7 @@ function register_nav_menus( $locations = array() ) {
|
||||
/**
|
||||
* Unregisters a navigation menu for a theme.
|
||||
*
|
||||
* @param array $location the menu location identifier
|
||||
*
|
||||
* @param string $location The menu location identifier.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
function unregister_nav_menu( $location ) {
|
||||
@@ -142,9 +138,8 @@ function get_nav_menu_locations() {
|
||||
* @return bool Whether location has a menu.
|
||||
*/
|
||||
function has_nav_menu( $location ) {
|
||||
global $_wp_registered_nav_menus;
|
||||
|
||||
if ( ! isset( $_wp_registered_nav_menus[ $location ] ) ) {
|
||||
$registered_nav_menus = get_registered_nav_menus();
|
||||
if ( ! isset( $registered_nav_menus[ $location ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,7 +441,7 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @see wp_update_nav_menu_items()
|
||||
* @see wp_update_nav_menu_item()
|
||||
*
|
||||
* @param int $menu_id ID of the updated menu.
|
||||
* @param int $menu_item_db_id ID of the updated menu item.
|
||||
@@ -461,12 +456,15 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
|
||||
* Returns all navigation menu objects.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.1.0 Default value of the 'orderby' argument was changed from 'none'
|
||||
* to 'name'.
|
||||
*
|
||||
* @param array $args Array of arguments passed on to get_terms().
|
||||
* @return array menu objects
|
||||
* @param array $args Optional. Array of arguments passed on to {@see get_terms()}.
|
||||
* Default empty array.
|
||||
* @return array Menu objects.
|
||||
*/
|
||||
function wp_get_nav_menus( $args = array() ) {
|
||||
$defaults = array( 'hide_empty' => false, 'orderby' => 'none' );
|
||||
$defaults = array( 'hide_empty' => false, 'orderby' => 'name' );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
/**
|
||||
@@ -513,13 +511,15 @@ function _sort_nav_menu_items( $a, $b ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if a menu item is valid. Bug #13958
|
||||
* Return if a menu item is valid.
|
||||
*
|
||||
* @link https://core.trac.wordpress.org/ticket/13958
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @access private
|
||||
*
|
||||
* @param object $menu_item The menu item to check
|
||||
* @return bool false if invalid, else true.
|
||||
* @param object $item The menu item to check.
|
||||
* @return bool False if invalid, otherwise true.
|
||||
*/
|
||||
function _is_valid_nav_menu_item( $item ) {
|
||||
if ( ! empty( $item->_invalid ) )
|
||||
@@ -529,13 +529,13 @@ function _is_valid_nav_menu_item( $item ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all menu items of a navigation menu.
|
||||
* Return all menu items of a navigation menu.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $menu menu name, id, or slug
|
||||
* @param string $args
|
||||
* @return mixed $items array of menu items, else false.
|
||||
* @param string $menu Menu name, ID, or slug.
|
||||
* @param array $args Optional. Arguments to pass to {@see get_posts()}.
|
||||
* @return mixed $items Array of menu items, otherwise false.
|
||||
*/
|
||||
function wp_get_nav_menu_items( $menu, $args = array() ) {
|
||||
$menu = wp_get_nav_menu_object( $menu );
|
||||
@@ -663,6 +663,11 @@ function wp_setup_nav_menu_item( $menu_item ) {
|
||||
|
||||
$original_object = get_post( $menu_item->object_id );
|
||||
$original_title = $original_object->post_title;
|
||||
|
||||
if ( '' === $original_title ) {
|
||||
$original_title = sprintf( __( '#%d (no title)' ), $original_object->ID );
|
||||
}
|
||||
|
||||
$menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
|
||||
|
||||
} elseif ( 'taxonomy' == $menu_item->type ) {
|
||||
@@ -683,7 +688,7 @@ function wp_setup_nav_menu_item( $menu_item ) {
|
||||
$menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
|
||||
|
||||
} else {
|
||||
$menu_item->type_label = __('Custom');
|
||||
$menu_item->type_label = __('Custom Link');
|
||||
$menu_item->title = $menu_item->post_title;
|
||||
$menu_item->url = empty( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url;
|
||||
}
|
||||
@@ -801,7 +806,7 @@ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_
|
||||
'post_type' == $menu_item_type
|
||||
) {
|
||||
$menu_item_ids[] = (int) $menu_item->ID;
|
||||
} else if (
|
||||
} elseif (
|
||||
'taxonomy' == $object_type &&
|
||||
'taxonomy' == $menu_item_type &&
|
||||
get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy
|
||||
|
||||
Reference in new issue
Block a user