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.

git-svn-id: https://develop.svn.wordpress.org/trunk@41583 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-09-24 11:27:17 +00:00
parent 5346347de7
commit 97564616e1
1 changed files with 13 additions and 5 deletions

View File

@ -1018,11 +1018,19 @@ function the_meta() {
if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n";
foreach ( (array) $keys as $key ) {
$keyt = trim($key);
if ( is_protected_meta( $keyt, 'post' ) )
$keyt = trim( $key );
if ( is_protected_meta( $keyt, 'post' ) ) {
continue;
$values = array_map('trim', get_post_custom_values($key));
$value = implode($values,', ');
}
$values = array_map( 'trim', get_post_custom_values( $key ) );
$value = implode( $values, ', ' );
$html = sprintf( "<li><span class='post-meta-key'>%s</span> %s</li>\n",
/* translators: %s: Post custom field name */
sprintf( _x( '%s:', 'Post custom field name' ), $key ),
$value
);
/**
* Filters the HTML output of the li element in the post custom fields list.
@ -1033,7 +1041,7 @@ function the_meta() {
* @param string $key Meta key.
* @param string $value Meta value.
*/
echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
echo apply_filters( 'the_meta_key', $html, $key, $value );
}
echo "</ul>\n";
}