Make WordPress Core


Ignore:
Timestamp:
11/24/2017 05:20:39 AM (7 years ago)
Author:
dd32
Message:

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

Props campusboy1987, birgire.
Fixes #42629.

File:
1 edited

Legend:

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

    r42201 r42225  
    10171017function the_meta() {
    10181018    if ( $keys = get_post_custom_keys() ) {
    1019         echo "<ul class='post-meta'>\n";
     1019        $li_html = '';
    10201020        foreach ( (array) $keys as $key ) {
    10211021            $keyt = trim( $key );
     
    10421042             * @param string $value Meta value.
    10431043             */
    1044             echo apply_filters( 'the_meta_key', $html, $key, $value );
    1045         }
    1046         echo "</ul>\n";
     1044            $li_html .= apply_filters( 'the_meta_key', $html, $key, $value );
     1045        }
     1046
     1047        if ( $li_html ) {
     1048            echo "<ul class='post-meta'>\n{$li_html}</ul>\n";
     1049        }
    10471050    }
    10481051}
Note: See TracChangeset for help on using the changeset viewer.