ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes ); // returns all the hidden metaboxes to the js function: wpNavMenu.initial_meta_boxes() return join( ',', $hidden_meta_boxes ); } } /** * Creates metaboxes for any post type menu item. * * @since 3.0.0 */ function wp_nav_menu_post_type_metaboxes() { $post_types = get_post_types( array( 'public' => true ), 'object' ); if ( !$post_types ) return; foreach ( $post_types as $post_type ) { $id = $post_type->name; add_meta_box( "add-{$id}", sprintf( __('Add %s'), $post_type->label ), 'wp_nav_menu_item_post_type_metabox', 'nav-menus', 'side', 'default', $post_type ); } } /** * Creates metaboxes for any taxonomy menu item. * * @since 3.0.0 */ function wp_nav_menu_taxonomy_metaboxes() { $taxonomies = get_taxonomies( array( 'show_ui' => true ), 'object' ); if ( !$taxonomies ) return; foreach ( $taxonomies as $tax ) { $id = $tax->name; add_meta_box( "add-{$id}", sprintf( __('Add %s'), $tax->label ), 'wp_nav_menu_item_taxonomy_metabox', 'nav-menus', 'side', 'default', $tax ); } } /** * Displays a metabox for managing the active menu being edited. * * @since 3.0.0 */ function wp_nav_menu_manage_menu_metabox( $object, $menu ) { ?>


'nav_menu_item', 'post_status' => 'any', 'meta_key' => '_menu_item_type', 'numberposts' => -1, 'orderby' => 'title', ); // @todo transient caching of these results with proper invalidation on updating links $links = get_posts( $args ); ?>

$post_type['args']->name, 'numberposts' => -1, 'orderby' => 'title', ); // @todo transient caching of these results with proper invalidation on updating of a post of this type $posts = get_posts( $args ); if ( !$posts ) $error = '
  • '. sprintf( __( 'No %s exists' ), $post_type['args']->label ) .'
  • '; $pt_names = ''; if ( is_array($posts) ) { foreach ( $posts as $post ) { if ( $post->post_title ) { $pt_names .= htmlentities( $post->post_title ) .'|'; } } } $id = $post_type['args']->name; ?>


    0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false, 'include_last_update_time' => false, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'pad_counts' => false ); // @todo transient caching of these results with proper invalidation on updating of a tax of this type $terms = get_terms( $taxonomy['args']->name, $args ); if ( !$terms || is_wp_error($terms) ) $error = '
  • '. sprintf( __( 'No %s exists' ), $taxonomy['args']->label ) .'
  • '; $term_names = ''; if ( is_array($terms) ) { foreach ( $terms as $term ) { if ( $term->name ) { $term_names .= htmlentities( $term->name ) .'|'; } } } $id = $taxonomy['args']->name; ?>


    post_parent) ) $menu_item->post_parent = $menu_item->parent; // Get all attachements and links if ( in_array($object, array( 'attachment', 'custom' )) ) $menu_item->post_parent = 0; if ( 0 == $menu_item->post_parent ) { // Set up the menu item $menu_item = wp_setup_nav_menu_item( $menu_item, $object_type, $object ); // No blank titles if ( empty($menu_item->title) ) continue; $attributes = ( 'backend' == $context ) ? ' id="menu-item-'. $i .'" value="'. $i .'"' : ''; $output .= ''; $output .= wp_get_nav_menu_item( $menu_item, $object_type, $object ); $output .= wp_get_nav_menu_sub_items( $menu_item->ID, $object_type, $object, $context ); $output .= ''; ++$i; } } return $output; } /** * Recursive function to retrieve sub menu items. * * @since 3.0.0 * * @param string $childof The Parent ID. * @param string $object_type The object type. * @param string $object The object name. * @return string $output sub menu items. */ function wp_get_nav_menu_sub_items( $childof, $object_type, $object = null, $context = 'frontend' ) { $args = array( 'child_of' => $childof, 'parent' => $childof, 'hide_empty' => false, ); switch ( $object_type ) { case 'post_type': $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); if ( in_array( $object, $hierarchical_post_types ) ) { $args['post_type'] = $object; $sub_menu_items = get_pages( $args ); } else { $sub_menu_items = array(); } break; case 'taxonomy': if ( is_taxonomy_hierarchical( $object ) ) { $sub_menu_items = get_terms( $object, $args ); } else { $sub_menu_items = array(); } break; default: $sub_menu_items = array(); break; } $output = ''; $i = 1; if ( !empty($sub_menu_items) && !is_wp_error($sub_menu_items) ) { $output .= ''; } return $output; } ?>