Advertisements

_post_states

Definition:
function _post_states($post) {}

Parameters

  • $post

Defined filters

  • display_post_states
    apply_filters( 'display_post_states', $post_states )

Source code

function _post_states($post) {

	$post_states = array();

	if ( isset($_GET['post_status']) )

		$post_status = $_GET['post_status'];

	else

		$post_status = '';



	if ( !empty($post->post_password) )

		$post_states['protected'] = __('Password protected');

	if ( 'private' == $post->post_status && 'private' != $post_status )

		$post_states['private'] = __('Private');

	if ( 'draft' == $post->post_status && 'draft' != $post_status )

		$post_states['draft'] = __('Draft');

	if ( 'pending' == $post->post_status && 'pending' != $post_status )

		/* translators: post state */

		$post_states['pending'] = _x('Pending', 'post state');

	if ( is_sticky($post->ID) )

		$post_states['sticky'] = __('Sticky');



	$post_states = apply_filters( 'display_post_states', $post_states );



	if ( ! empty($post_states) ) {

		$state_count = count($post_states);

		$i = 0;

		echo ' - ';

		foreach ( $post_states as $state ) {

			++$i;

			( $i == $state_count ) ? $sep = '' : $sep = ', ';

			echo "<span class='post-state'>$state$sep</span>";

		}

	}



	if ( get_post_format( $post->ID ) )

		echo ' - <span class="post-state-format">' . get_post_format_string( get_post_format( $post->ID ) ) . '</span>';

}

4357

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: