get_post_format_string() WordPress Function

The get_post_format_string function allows you to get the string for a particular post format. This is useful for displaying the post format name in your theme.

get_post_format_string( string $slug ) #

Returns a pretty, translated version of a post format slug


Parameters

$slug

(string)(Required)A post format slug.


Top ↑

Return

(string) The translated post format name.


Top ↑

Source

File: wp-includes/post-formats.php

function get_post_format_string( $slug ) {
	$strings = get_post_format_strings();
	if ( ! $slug ) {
		return $strings['standard'];
	} else {
		return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : '';
	}
}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.