post_format_meta_box

Definition:
function post_format_meta_box( $post, $box ) {}

Display post format form elements.

Parameters

  • object $post
  • $box

Source code

function post_format_meta_box( $post, $box ) {

	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :

	$post_formats = get_theme_support( 'post-formats' );



	if ( is_array( $post_formats[0] ) ) :

		$post_format = get_post_format( $post->ID );

		if ( !$post_format )

			$post_format = '0';

		// Add in the current one if it isn't there yet, in case the current theme doesn't support it

		if ( $post_format && !in_array( $post_format, $post_formats[0] ) )

			$post_formats[0][] = $post_format;

	?>

	<div id="post-formats-select">

		<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0"><?php _e('Standard'); ?></label>

		<?php foreach ( $post_formats[0] as $format ) : ?>

		<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>

		<?php endforeach; ?><br />

	</div>

	<?php endif; endif;

}

10116

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: