Menu item -> append should be a key/name, not a label. see #11817

git-svn-id: http://svn.automattic.com/wordpress/trunk@13722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-03-16 22:01:49 +00:00
parent 04ee3c93cb
commit 60f8f5a6aa
3 changed files with 18 additions and 18 deletions

View File

@ -21,8 +21,8 @@ function wp_nav_menu_post_type_metaboxes() {
foreach ( $post_types as $post_type ) {
if ( !in_array($post_type->name, $allowed_types) )
continue;
$id = sanitize_title_with_dashes( $post_type->label );
$id = $post_type->name;
// delete_transient( "nav_menu_items_{$post_type->name}" );
// delete_transient( "nav_menu_sub_items_{$post_type->name}" );
@ -37,7 +37,7 @@ function wp_nav_menu_post_type_metaboxes() {
*/
function wp_nav_menu_taxonomy_metaboxes() {
$taxonomies = get_taxonomies( array( 'show_ui' => true ), 'object' );
if ( !$taxonomies )
return false;
@ -45,12 +45,11 @@ function wp_nav_menu_taxonomy_metaboxes() {
foreach ( $taxonomies as $tax ) {
if ( !in_array($tax->name, $allowed_types) )
continue;
$id = sanitize_title_with_dashes( $tax->label );
$id = $tax->name;
// delete_transient( "nav_menu_items_{$tax->name}" );
// delete_transient( "nav_menu_sub_items_{$tax->name}" );
add_meta_box( "add-{$id}", sprintf( __('Add an Existing %s'), $tax->singular_label ), 'wp_nav_menu_item_taxonomy_metabox', 'menus', 'side', 'default', $tax );
}
}
@ -182,7 +181,7 @@ function wp_nav_menu_item_post_type_metabox( $object, $post_type ) {
}
}
$id = sanitize_title_with_dashes( $post_type['args']->label );
$id = $post_type['args']->name;
?>
<p class="quick-search-wrap">
<input type="text" class="quick-search regular-text" value="" />
@ -197,14 +196,14 @@ function wp_nav_menu_item_post_type_metabox( $object, $post_type ) {
<div id="existing-<?php echo esc_attr( $id ); ?>" class="list-wrap">
<div class="list-container">
<ul class="list">
<?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $query->posts, 'post_type', $post_type['args']->name ); ?>
<?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $query->posts, 'post_type', $id ); ?>
</ul>
</div><!-- /.list-container-->
</div><!-- /#existing-categories-->
<p class="add-to-menu">
<a class="button-secondary"><?php _e('Add to Menu'); ?></a>
</p>
<input type="hidden" class="autocomplete" name="autocomplete-<?php echo esc_attr( $post_type['args']->name ); ?>-names" value="<?php echo esc_js( $pt_names ); ?>" />
<input type="hidden" class="autocomplete" name="autocomplete-<?php echo esc_attr( $id ); ?>-names" value="<?php echo esc_js( $pt_names ); ?>" />
<br class="clear" />
<script type="text/javascript" charset="utf-8">
// <![CDATA[
@ -252,7 +251,7 @@ function wp_nav_menu_item_taxonomy_metabox( $object, $taxonomy ) {
}
}
$id = sanitize_title_with_dashes( $taxonomy['args']->label );
$id = $taxonomy['args']->name;
?>
<p class="quick-search-wrap">
<input type="text" class="quick-search regular-text" value="" />
@ -267,14 +266,14 @@ function wp_nav_menu_item_taxonomy_metabox( $object, $taxonomy ) {
<div id="existing-<?php echo esc_attr( $id ); ?>" class="list-wrap">
<div class="list-container">
<ul class="list">
<?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $terms, 'taxonomy', $taxonomy['args']->name ); ?>
<?php echo isset( $error ) ? $error : wp_nav_menu_get_items( $terms, 'taxonomy', $id ); ?>
</ul>
</div><!-- /.list-container-->
</div><!-- /#existing-categories-->
<p class="add-to-menu">
<a class="button-secondary"><?php _e('Add to Menu'); ?></a>
</p>
<input type="hidden" class="autocomplete" name="autocomplete-<?php echo esc_attr($taxonomy['args']->name); ?>-names" value="<?php echo esc_js( $term_names ); ?>" />
<input type="hidden" class="autocomplete" name="autocomplete-<?php echo esc_attr($id); ?>-names" value="<?php echo esc_js( $term_names ); ?>" />
<br class="clear" />
<script type="text/javascript" charset="utf-8">
// <![CDATA[

View File

@ -116,7 +116,7 @@ function wp_get_nav_menu( $args = array() ) {
// Setup the $menu_item variables
$menu_item = wp_setup_nav_menu_item( $menu_item, 'frontend' );
$type = sanitize_title_with_dashes( $menu_item->append );
$type = $menu_item->append;
$maybe_value = 'frontend' == $args->context ? '' : ' value="'. $menu_item->ID .'"';
$classes = 'frontend' == $args->context ? ' class="menu-item-type-'. $type . $menu_item->li_class .'"' : '';

View File

@ -171,7 +171,8 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
$menu_item->object_id = get_post_meta( $menu_item->ID, 'menu_item_object_id', true );
$menu_item->parent_id = (int) $menu_item->post_parent;
$menu_item->type = get_post_meta( $menu_item->ID, 'menu_item_type', true );
$menu_item->append = _x( get_post_meta( $menu_item->ID, 'menu_item_append', true ), 'nav menu item type' );
$menu_item->append = get_post_meta( $menu_item->ID, 'menu_item_append', true );
$menu_item->title = $menu_item->post_title;
$menu_item->url = get_post_meta( $menu_item->ID, 'menu_item_url', true );
@ -190,7 +191,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
$menu_item->object_id = (int) $menu_item->ID;
$menu_item->parent_id = (int) $menu_item->post_parent;
$menu_item->type = 'custom'; //$menu_item_type
$menu_item->append = _x( 'Custom', 'nav menu item type' );
$menu_item->append = 'custom';
$menu_item->attr_title = strip_tags( $menu_item->post_excerpt );
$menu_item->description = strip_tags( $menu_item->post_content );
@ -207,7 +208,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
$menu_item->type = $menu_item_type;
$object = get_post_type_object( $menu_item_object );
$menu_item->append = _x( $object->singular_label, 'nav menu item type' );
$menu_item->append = $object->name;
$menu_item->title = $menu_item->post_title;
$menu_item->url = get_permalink( $menu_item->ID );
@ -225,7 +226,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
$menu_item->type = $menu_item_type;
$object = get_taxonomy( $menu_item_object );
$menu_item->append = _x( $object->singular_label, 'nav menu item type' );
$menu_item->append = $object->name;
$menu_item->title = $menu_item->name;
$menu_item->url = get_term_link( $menu_item, $menu_item_object );
@ -234,7 +235,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
$menu_item->description = strip_tags( $menu_item->description );
break;
}
$menu_item->classes = get_post_meta( $menu_item->ID, 'menu_item_classes', true );
$menu_item->xfn = get_post_meta( $menu_item->ID, 'menu_item_xfn', true );