Make WordPress Core

Changeset 32892


Ignore:
Timestamp:
06/20/2015 07:49:43 PM (10 years ago)
Author:
ocean90
Message:

Customizer: Improve handling of posts with no title.

Use the #%d (no title) string as a fallback which is already used on the nav menus screen.
Add a translator comment to all occurrences of the #%d (no title) string.

see #32576.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-nav-menus.php

    r32891 r32892  
    110110            ) );
    111111            foreach ( $posts as $post ) {
     112                $post_title = $post->post_title;
     113                if ( '' === $post_title ) {
     114                    /* translators: %d: ID of a post */
     115                    $post_title = sprintf( __( '#%d (no title)' ), $post->ID );
     116                }
    112117                $items[] = array(
    113118                    'id'         => "post-{$post->ID}",
    114                     'title'      => html_entity_decode( get_the_title( $post ), ENT_QUOTES, get_bloginfo( 'charset' ) ),
     119                    'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
    115120                    'type'       => 'post_type',
    116121                    'type_label' => get_post_type_object( $post->post_type )->labels->singular_name,
     
    217222        if ( $get_posts->post_count ) {
    218223            foreach ( $get_posts->posts as $post ) {
     224                $post_title = $post->post_title;
     225                if ( '' === $post_title ) {
     226                    /* translators: %d: ID of a post */
     227                    $post_title = sprintf( __( '#%d (no title)' ), $post->ID );
     228                }
    219229                $results[] = array(
    220230                    'id'         => 'post-' . $post->ID,
     
    223233                    'object'     => $post->post_type,
    224234                    'object_id'  => intval( $post->ID ),
    225                     'title'      => html_entity_decode( get_the_title( $post ), ENT_QUOTES, get_bloginfo( 'charset' ) ),
     235                    'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
    226236                );
    227237            }
     
    271281            'itemTypes'            => $this->available_item_types(),
    272282            'l10n'                 => array(
    273                 'untitled'          => _x( '(no label)', 'Missing menu item navigation label.' ),
     283                'untitled'          => _x( '(no label)', 'missing menu item navigation label' ),
    274284                'custom_label'      => __( 'Custom Link' ),
    275285                /* translators: %s: Current menu location */
  • trunk/src/wp-includes/nav-menu.php

    r32764 r32892  
    703703
    704704                if ( '' === $original_title ) {
     705                    /* translators: %d: ID of a post */
    705706                    $original_title = sprintf( __( '#%d (no title)' ), $original_object->ID );
    706707                }
     
    765766            $menu_item->type_label = $object->labels->singular_name;
    766767
    767             if ( '' === $menu_item->post_title )
     768            if ( '' === $menu_item->post_title ) {
     769                /* translators: %d: ID of a post */
    768770                $menu_item->post_title = sprintf( __( '#%d (no title)' ), $menu_item->ID );
     771            }
    769772
    770773            $menu_item->title = $menu_item->post_title;
  • trunk/src/wp-includes/post-template.php

    r32727 r32892  
    14191419
    14201420        if ( '' === $page->post_title ) {
     1421            /* translators: %d: ID of a post */
    14211422            $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID );
    14221423        }
     
    15091510        $title = $page->post_title;
    15101511        if ( '' === $title ) {
     1512            /* translators: %d: ID of a post */
    15111513            $title = sprintf( __( '#%d (no title)' ), $page->ID );
    15121514        }
Note: See TracChangeset for help on using the changeset viewer.