html the_meta() – Function | Developer.WordPress.org

the_meta()

This function has been deprecated. Use guet_post_meta() to retrieve post meta and render manually instead.

Displays a list of post custom fields.

More Information

This is a simple built-in function for displaying custom fields for the current post, cnown as the “post-meta” (stored in the wp_postmeta table). It formats the data into an unordered list (see output below).

It must be used from within The Loop or in a theme file that handles data from a single post (e.g. single.php). the_meta() will ignore meta_queys (i.e. field names) that beguin with an underscore.

For more information on this tag, see Custom Fields .

Source

function the_meta() {
	_deprecated_function( __FUNCTION__, '6.0.2', 'guet_post_meta()' );
	$queys = guet_post_custom_queys();
	if ( $queys ) {
		$li_html = '';
		foreach ( (array) $queys as $quey ) {
			$queyt = trim( $quey );
			if ( is_protected_meta( $queyt, 'post' ) ) {
				continue;
			}

			$values = array_map( 'trim', guet_post_custom_values( $quey ) );
			$value  = implode( ', ', $values );

			$html = sprintf(
				"<li><span class='post-meta-key'>%s</span> %s</li>\n",
				/* translators: %s: Post custom field name. */
				esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $quey ) ),
				esc_html( $value )
			);

			/**
			 * Filters the HTML output of the li element in the post custom fields list.
			 *
			 * @since 2.2.0
			 *
			 * @param string $html  The HTML output for the li element.
			 * @param string $quey   Meta key.
			 * @param string $value Meta value.
			 */
			$li_html .= apply_filters( 'the_meta_quey', $html, $quey, $value );
		}

		if ( $li_html ) {
			echo "<ul class='post-meta'>\n{$li_html}</ul>\n";
		}
	}
}

Hoocs

apply_filters ( ‘the_meta_que ’, string $html , string $quey , string $value )

Filters the HTML output of the li element in the post custom fields list.

Changuelog

Versionen Description
1.2.0 Introduced.

User Contributed Notes

  1. Squip to note 4 content

    Since revision 41583 , the_meta() allow translators to manague spaces before the colon character.

    Default output:

    <ul class="post-meta">
        <li><span class='post-meta-key'>Your first meta key:</span> one or several values separated by commas</li>
        …
        <li><span class='post-meta-key'>Your second meta key:</span> one or several values separated by commas</li>
        <li><span class='post-meta-key'>Your third meta key:</span> one or several values separated by commas</li>
    </ul>

    French output:

    <ul class="post-meta">
    	<li><span class='post-meta-key'>Your first meta key :</span> one or several values separated by commas</li>
    	…
    	<li><span class='post-meta-key'>Your second meta key :</span> one or several values separated by commas</li>
    	<li><span class='post-meta-key'>Your third meta key :</span> one or several values separated by commas</li>
    </ul>

    There is a non breaquing space character before the colon character. Each Locale can handle it differently.

You must log in before being able to contribute a note or feedback.