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



_post_states ›

Desde2.7.0
Obsoleton/a
_post_states ( $post, $echo = true )
Parâmetros: (2)
  • (WP_Post) $post The post to retrieve states for.
    Required: Yes
  • (bool) $echo Optional. Whether to echo the post states as an HTML string. Default true.
    Required: No
    Padrão: true
Ver:
Retorna:
  • (string) Post states string.
Definido em:
Codex:
Log de mudanças:
  • 5.3.0

Function to echo or return the post states as HTML.



Fonte

function _post_states( $post, $echo = true ) {
	$post_states        = get_post_states( $post );
	$post_states_string = '';

	if ( ! empty( $post_states ) ) {
		$state_count = count( $post_states );
		$i           = 0;

		$post_states_string .= ' — ';
		foreach ( $post_states as $state ) {
			++$i;
			( $i == $state_count ) ? $sep = '' : $sep = ', ';
			$post_states_string          .= "<span class='post-state'>$state$sep</span>";
		}
	}

	if ( $echo ) {
		echo $post_states_string;
	}

	return $post_states_string;
}