Make WordPress Core

Changeset 25741


Ignore:
Timestamp:
10/09/2013 06:46:34 PM (11 years ago)
Author:
helen
Message:

Show a label for the "Home" page nav menu item checkbox. props SergeyBiryukov. props ericlewis for the initial patch. fixes #25410.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/nav-menu.php

    r25643 r25741  
    300300        $output .= '<label class="menu-item-title">';
    301301        $output .= '<input type="checkbox" class="menu-item-checkbox';
    302         if ( property_exists( $item, 'front_or_home' ) && $item->front_or_home ) {
    303             $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), get_the_title( $item->ID ) );
     302
     303        if ( ! empty( $item->front_or_home ) )
    304304            $output .= ' add-to-top';
    305         } elseif ( property_exists( $item, 'label' ) ) {
     305
     306        $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
     307
     308        if ( ! empty( $item->label ) ) {
    306309            $title = $item->label;
    307         }
    308         $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
    309         if ( isset( $item->post_type ) )
    310             $output .= empty( $item->label ) ? esc_html( get_the_title( $item->ID ) ) : esc_html( $item->label );
    311         else
    312             $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
     310        } elseif ( isset( $item->post_type ) ) {
     311            //duplicate_hook
     312            $title = apply_filters( 'the_title', $item->post_title, $item->ID );
     313            if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title )
     314                $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title );
     315        }
     316
     317        $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
    313318        $output .= '</label>';
    314319
Note: See TracChangeset for help on using the changeset viewer.