Template: Don't output an empty `<ul>` in `the_meta()` when a post only has protected metas.

Props campusboy1987, birgire.
Fixes #42629.


git-svn-id: https://develop.svn.wordpress.org/trunk@42225 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2017-11-24 05:20:39 +00:00
parent 26fb077862
commit 555eab6391
1 changed files with 6 additions and 3 deletions

View File

@ -1016,7 +1016,7 @@ function post_custom( $key = '' ) {
*/
function the_meta() {
if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n";
$li_html = '';
foreach ( (array) $keys as $key ) {
$keyt = trim( $key );
if ( is_protected_meta( $keyt, 'post' ) ) {
@ -1041,9 +1041,12 @@ function the_meta() {
* @param string $key Meta key.
* @param string $value Meta value.
*/
echo apply_filters( 'the_meta_key', $html, $key, $value );
$li_html .= apply_filters( 'the_meta_key', $html, $key, $value );
}
if ( $li_html ) {
echo "<ul class='post-meta'>\n{$li_html}</ul>\n";
}
echo "</ul>\n";
}
}