wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
_post_states › WordPress Function
Depuis2.7.0
Dépréciéen/a
› _post_states ( $post, $display = true )
Paramètres: (2) |
|
Voir: | |
Retourne: |
|
Défini(e) dans: |
|
Codex: | |
Changelog: |
|
Echoes or returns the post states as HTML.
Fonctions en relation: get_post_states, get_post_statuses, get_post_status, get_post_stati, post_exists
Source
function _post_states( $post, $display = 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; $separator = ( $i < $state_count ) ? ', ' : ''; $post_states_string .= "<span class='post-state'>{$state}{$separator}</span>"; } } if ( $display ) { echo $post_states_string; } return $post_states_string; }