Make WordPress Core

Ticket #14975: 14975.4.diff

File 14975.4.diff, 1.7 KB (added by DrewAPicture, 13 years ago)
  • wp-admin/includes/nav-menu.php

     
    5757                                $original_title = false;
    5858                } elseif ( 'post_type' == $item->type ) {
    5959                        $original_object = get_post( $item->object_id );
    60                         $original_title = $original_object->post_title;
     60                        $original_title = get_the_title( $original_object->ID );
    6161                }
    6262
    6363                $classes = array(
     
    262262                $output .= '<label class="menu-item-title">';
    263263                $output .= '<input type="checkbox" class="menu-item-checkbox';
    264264                if ( property_exists( $item, 'front_or_home' ) && $item->front_or_home ) {
    265                         $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $item->post_title );
     265                        $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), get_the_title( $item->ID ) );
    266266                        $output .= ' add-to-top';
    267267                } elseif ( property_exists( $item, 'label' ) ) {
    268268                        $title = $item->label;
    269269                }
    270270                $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
    271                 $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
    272                 $output .= '</label>';
     271                if ( isset( $item->post_type ) )
     272                        $output .= empty( $item->label ) ? esc_html( get_the_title( $item->ID ) ) : esc_html( $item->label );
     273                else
     274                        $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
     275                $output .= '</label>';
    273276
    274277                // Menu item hidden fields
    275278                $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';