Advertisements

_media_states

Definition:
function _media_states( $post ) {}

Parameters

  • $post

Defined filters

  • display_media_states
    apply_filters( 'display_media_states', $media_states )

Source code

function _media_states( $post ) {

	$media_states = array();

	$stylesheet = get_option('stylesheet');



	if ( current_theme_supports( 'custom-header') ) {

		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );

		if ( ! empty( $meta_header ) && $meta_header == $stylesheet )

			$media_states[] = __( 'Header Image' );

	}



	if ( current_theme_supports( 'custom-background') ) {

		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );

		if ( ! empty( $meta_background ) && $meta_background == $stylesheet )

			$media_states[] = __( 'Background Image' );

	}



	$media_states = apply_filters( 'display_media_states', $media_states );



	if ( ! empty( $media_states ) ) {

		$state_count = count( $media_states );

		$i = 0;

		echo ' - ';

		foreach ( $media_states as $state ) {

			++$i;

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

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

		}

	}

}

15444

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: