Uma área de pesquisa sobre o WordPress para devs e autores do tema



has_post_format ›

Desde3.1.0
Obsoleton/a
has_post_format ( $format = array(), $post = null )
Parâmetros: (2)
  • (string|array) $format Optional. The format or formats to check.
    Required: No
    Padrão: array()
  • (object|int|null) $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
    Required: No
    Padrão: null
Retorna:
  • (bool) True if the post has any of the given formats (or any format, if no format specified), false otherwise.
Definido em:
Codex:

Check if a post has any of the given formats, or any format.



Fonte

function has_post_format( $format = array(), $post = null ) {
	$prefixed = array();

	if ( $format ) {
		foreach ( (array) $format as $single ) {
			$prefixed[] = 'post-format-' . sanitize_key( $single );
		}
	}

	return has_term( $prefixed, 'post_format', $post );
}