ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = ''; if ( 'taxonomy' == $item->type ) { $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); } elseif ( 'post_type' == $item->type ) { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } ?>
  • '. sprintf( __( 'No %s exists' ), $post_type['args']->label ) .'
  • '; $current_tab = 'all'; if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) { $current_tab = $_REQUEST[$post_type_name . '-tab']; } if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); ?>


    name; if ( ! $term_count = wp_count_terms( $taxonomy_name ) ) { echo '

    ' . __( 'No items.' ) . '

    '; return; } // paginate browsing for large numbers of objects $per_page = 13; $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1; $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0; $args = array( 'child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'include_last_update_time' => false, 'number' => $per_page, 'offset' => $offset, 'order' => 'ASC', 'orderby' => 'name', 'pad_counts' => false, ); $num_pages = ceil( $term_count / $per_page ); $page_links = paginate_links( array( 'base' => add_query_arg( array( $taxonomy_name . '-tab' => 'all', 'paged' => '%#%', ) ), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $num_pages, 'current' => $pagenum )); $walker = new Walker_Nav_Menu_Checklist; // @todo transient caching of these results with proper invalidation on updating of a tax of this type $terms = get_terms( $taxonomy_name, $args ); if ( ! $terms || is_wp_error($terms) ) $error = '
  • '. sprintf( __( 'No %s exists' ), $taxonomy['args']->label ) .'
  • '; $current_tab = 'most-used'; if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) { $current_tab = $_REQUEST[$taxonomy_name . '-tab']; } if ( ! empty( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) { $current_tab = 'search'; } $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); ?>
    $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) ); } else { $searched = ''; $search_results = array(); } ?>


    $_item_object_data ) { if ( empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked ( ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default 'custom' != $_item_object_data['menu-item-type'] || // or it's not a custom menu item ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists ) ) { continue; // then this potential menu item is not getting added to this menu } // if this possible menu item doesn't actually have a menu database ID yet if ( empty( $_item_object_data['menu-item-db-id'] ) || ( 0 > $_possible_db_id ) || $_possible_db_id != $_item_object_data['menu-item-db-id'] ) { $_actual_db_id = 0; } else { $_actual_db_id = (int) $_item_object_data['menu-item-db-id']; } $args = array( 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ), 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ), 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ), 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ), 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ), 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ), 'menu-item-append' => ( isset( $_item_object_data['menu-item-append'] ) ? $_item_object_data['menu-item-append'] : '' ), 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ), 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ), 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ), 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ), 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ), 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ), 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ), ); $items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args ); } } return $items_saved; } /** * Adds custom arguments to some of the meta box object types. * * @since 3.0.0 * * @access private * * @param object $object The post type or taxonomy meta-object. * @return object The post type of taxonomy object. */ function _wp_nav_menu_meta_box_object( $object = null ) { if ( isset( $object->name ) ) { // don't show media meta box if ( 'attachment' == $object->name ) return false; // pages should show most recent if ( 'page' == $object->name ) { $object->_default_query = array( 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', ); // posts should show only published items } elseif ( 'post' == $object->name ) { $object->_default_query = array( 'post_status' => 'publish', ); // cats should be in reverse chronological order } elseif ( 'category' == $object->name ) { $object->_default_query = array( 'orderby' => 'id', 'order' => 'DESC', ); } } return $object; } /** * Returns the menu item formatted to edit. * * @since 3.0.0 * * @param string $menu_item_id The ID of the menu item to format. * @return string|WP_Error $output The menu formatted to edit or error object on failure. */ function wp_get_nav_menu_to_edit( $menu_item_id = 0 ) { $menu = wp_get_nav_menu_object( $menu_item_id ); // If the menu exists, get its items. if ( is_nav_menu( $menu ) ) { $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') ); $walker = new Walker_Nav_Menu_Edit; return walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) ); } elseif ( is_wp_error( $menu ) ) { return $menu; } } /** * Returns the columns for the nav menus page. * * @since 3.0.0 * * @param string $menu_item_id The ID of the menu item to format. * @return string|WP_Error $output The menu formatted to edit or error object on failure. */ function wp_nav_menu_manage_columns() { return array( 'cb' => '', 'link-target' => __('Link Target'), 'css-classes' => __('CSS Classes'), 'xfn' => __('Link Relationship (XFN)'), 'description' => __('Description'), ); } ?>