Move Post Format UI out of Publish meta box and into its own box. see #15638

git-svn-id: https://develop.svn.wordpress.org/trunk@16678 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2010-12-02 02:42:38 +00:00
parent 6297b3184b
commit 86ab422fcc
5 changed files with 28 additions and 55 deletions
+23 -32
View File
@@ -151,38 +151,6 @@ echo esc_html( $visibility_trans ); ?></span>
</div><?php // /misc-pub-section ?>
<?php
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';
$post_format_display = get_post_format_string( $post_format );
// 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 class="misc-pub-section" id="post-formats"><label for="post-format"><?php _e( 'Format:' ); ?></label>
<b><span id="post-format-display"><?php echo esc_html( $post_format_display ); ?></span></b> <a href="#post-formats-select" class="edit-post-format hide-if-no-js"><?php _e('Edit'); ?></a>
<div id="post-formats-select" class="hide-if-js">
<input type="hidden" id="old-post-format" value="<?php echo esc_attr( $post_format ); ?>" />
<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('Default'); ?></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 />
<p>
<a href="#post-formats" class="save-post-format hide-if-no-js button"><?php _e('OK'); ?></a>
<a href="#post-formats" class="cancel-post-format hide-if-no-js"><?php _e('Cancel'); ?></a>
</p>
</div>
</div><?php // /misc-pub-section ?>
<?php endif; endif; ?>
<?php
// translators: Publish box date formt, see http://php.net/date
$datef = __( 'M j, Y @ G:i' );
@@ -263,6 +231,29 @@ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0
}
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';
$post_format_display = get_post_format_string( $post_format );
// 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('Default'); ?></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;
}
/**
* Display post tags form fields.
*