Make WordPress Core


Ignore:
Timestamp:
12/02/2010 02:42:38 AM (16 years ago)
Author:
markjaquith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r16502 r16678  
    153153
    154154<?php
    155 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
    156 $post_formats = get_theme_support( 'post-formats' );
    157 
    158 if ( is_array( $post_formats[0] ) ) :
    159         $post_format = get_post_format( $post->ID );
    160         if ( !$post_format )
    161                 $post_format = '0';
    162         $post_format_display = get_post_format_string( $post_format );
    163         // Add in the current one if it isn't there yet, in case the current theme doesn't support it
    164         if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
    165                 $post_formats[0][] = $post_format;
    166 ?>
    167 <div class="misc-pub-section" id="post-formats"><label for="post-format"><?php _e( 'Format:' ); ?></label>
    168 
    169  <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>
    170 
    171 <div id="post-formats-select" class="hide-if-js">
    172 <input type="hidden" id="old-post-format" value="<?php echo esc_attr( $post_format ); ?>" />
    173         <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>
    174         <?php foreach ( $post_formats[0] as $format ) : ?>
    175         <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>
    176         <?php endforeach; ?><br />
    177         <p>
    178          <a href="#post-formats" class="save-post-format hide-if-no-js button"><?php _e('OK'); ?></a>
    179          <a href="#post-formats" class="cancel-post-format hide-if-no-js"><?php _e('Cancel'); ?></a>
    180         </p>
    181 </div>
    182 </div><?php // /misc-pub-section ?>
    183 <?php endif; endif; ?>
    184 
    185 
    186 <?php
    187155// translators: Publish box date formt, see http://php.net/date
    188156$datef = __( 'M j, Y @ G:i' );
    … …  
    261229
    262230<?php
     231}
     232
     233
     234function post_format_meta_box( $post, $box ) {
     235        if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
     236        $post_formats = get_theme_support( 'post-formats' );
     237
     238        if ( is_array( $post_formats[0] ) ) :
     239                $post_format = get_post_format( $post->ID );
     240                if ( !$post_format )
     241                        $post_format = '0';
     242                $post_format_display = get_post_format_string( $post_format );
     243                // Add in the current one if it isn't there yet, in case the current theme doesn't support it
     244                if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
     245                        $post_formats[0][] = $post_format;
     246        ?>
     247        <div id="post-formats-select">
     248                <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>
     249                <?php foreach ( $post_formats[0] as $format ) : ?>
     250                <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>
     251                <?php endforeach; ?><br />
     252        </div>
     253        <?php endif; endif;
    263254}
    264255
Note: See TracChangeset for help on using the changeset viewer.