Make WordPress Core

Changeset 41583


Ignore:
Timestamp:
09/24/2017 11:27:17 AM (7 years ago)
Author:
SergeyBiryukov
Message:

I18N: Allow for post custom field name in the_meta() to be translated, e.g. to insert a non-breaking space before the colon.

Props audrasjb, johnbillion.
Fixes #41653.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r41567 r41583  
    10191019        echo "<ul class='post-meta'>\n";
    10201020        foreach ( (array) $keys as $key ) {
    1021             $keyt = trim($key);
    1022             if ( is_protected_meta( $keyt, 'post' ) )
     1021            $keyt = trim( $key );
     1022            if ( is_protected_meta( $keyt, 'post' ) ) {
    10231023                continue;
    1024             $values = array_map('trim', get_post_custom_values($key));
    1025             $value = implode($values,', ');
     1024            }
     1025
     1026            $values = array_map( 'trim', get_post_custom_values( $key ) );
     1027            $value = implode( $values, ', ' );
     1028
     1029            $html = sprintf( "<li><span class='post-meta-key'>%s</span> %s</li>\n",
     1030                /* translators: %s: Post custom field name */
     1031                sprintf( _x( '%s:', 'Post custom field name' ), $key ),
     1032                $value
     1033            );
    10261034
    10271035            /**
     
    10341042             * @param string $value Meta value.
    10351043             */
    1036             echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
     1044            echo apply_filters( 'the_meta_key', $html, $key, $value );
    10371045        }
    10381046        echo "</ul>\n";
Note: See TracChangeset for help on using the changeset viewer.