Changeset 29206 for trunk/src/wp-admin/includes/nav-menu.php
- Timestamp:
- 07/17/2014 09:13:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r28500 r29206 517 517 if ( $post_type ) { 518 518 $id = $post_type->name; 519 // give pages a higher priority519 // Give pages a higher priority. 520 520 $priority = ( 'page' == $post_type->name ? 'core' : 'default' ); 521 521 add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type ); … … 616 616 $post_type_name = $post_type['args']->name; 617 617 618 // paginate browsing for large numbers of post objects618 // Paginate browsing for large numbers of post objects. 619 619 $per_page = 50; 620 620 $pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; … … 763 763 $args['walker'] = $walker; 764 764 765 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list 765 /* 766 * If we're dealing with pages, let's put a checkbox for the front 767 * page at the top of the list. 768 */ 766 769 if ( 'page' == $post_type_name ) { 767 770 $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0; … … 855 858 $taxonomy_name = $taxonomy['args']->name; 856 859 857 // paginate browsing for large numbers of objects860 // Paginate browsing for large numbers of objects. 858 861 $per_page = 50; 859 862 $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; … … 1046 1049 if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) { 1047 1050 1048 // Loop through all the menu items' POST values 1051 // Loop through all the menu items' POST values. 1049 1052 foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) { 1050 1053 if ( 1051 empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked 1054 // Checkbox is not checked. 1055 empty( $_item_object_data['menu-item-object-id'] ) && 1052 1056 ( 1053 ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set 1054 in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default 1057 // And item type either isn't set. 1058 ! isset( $_item_object_data['menu-item-type'] ) || 1059 // Or URL is the default. 1060 in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || 1055 1061 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page) 1056 ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists 1062 // Or it *is* a custom menu item that already exists. 1063 ! empty( $_item_object_data['menu-item-db-id'] ) 1057 1064 ) 1058 1065 ) { 1059 continue; // then this potential menu item is not getting added to this menu 1066 // Then this potential menu item is not getting added to this menu. 1067 continue; 1060 1068 } 1061 1069 1062 // if this possible menu item doesn't actually have a menu database ID yet1070 // If this possible menu item doesn't actually have a menu database ID yet. 1063 1071 if ( 1064 1072 empty( $_item_object_data['menu-item-db-id'] ) || … … 1113 1121 ); 1114 1122 1115 // posts should show only published items1123 // Posts should show only published items. 1116 1124 } elseif ( 'post' == $object->name ) { 1117 1125 $object->_default_query = array( … … 1119 1127 ); 1120 1128 1121 // cats should be in reverse chronological order1129 // Categories should be in reverse chronological order. 1122 1130 } elseif ( 'category' == $object->name ) { 1123 1131 $object->_default_query = array( … … 1126 1134 ); 1127 1135 1128 // custom post types should show only published items1136 // Custom post types should show only published items. 1129 1137 } else { 1130 1138 $object->_default_query = array( … … 1227 1235 $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); 1228 1236 1229 // delete orphaned draft menu items1237 // Delete orphaned draft menu items. 1230 1238 $menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) ); 1231 1239
Note: See TracChangeset
for help on using the changeset viewer.