Make WordPress Core

Ticket #15443: post_formats_16405_meta-boxes.php

File post_formats_16405_meta-boxes.php, 2.2 KB (added by ev3rywh3re, 15 years ago)
Line 
1Index: meta-boxes.php
2===================================================================
3--- meta-boxes.php      (revision 16405)
4+++ meta-boxes.php      (working copy)
5@@ -153,16 +153,20 @@
6 
7 <?php
8 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
9-$post_formats = get_theme_support( 'post-formats' );
10+$post_format_support = get_theme_support( 'post-formats' );
11 
12-if ( is_array( $post_formats[0] ) ) : 
13+if ( is_array( $post_format_support[0] ) || $post_format_support === true ) : 
14+       if ( !is_array( $post_format_support[0] ) )
15+               $post_formats = array_keys( get_post_format_strings() );
16+       else
17+               $post_formats = $post_format_support[0];
18        $post_format = get_post_format( $post->ID );
19        if ( !$post_format )
20                $post_format = '0';
21        $post_format_display = get_post_format_string( $post_format );
22        // Add in the current one if it isn't there yet, in case the current theme doesn't support it
23-       if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
24-               $post_formats[0][] = $post_format;
25+       if ( $post_format && !in_array( $post_format, $post_formats ) )
26+               $post_formats[] = $post_format; 
27 ?>
28 <div class="misc-pub-section" id="post-formats"><label for="post-format"><?php _e( 'Format:' ); ?></label>
29 
30@@ -171,8 +175,10 @@
31 <div id="post-formats-select" class="hide-if-js">
32 <input type="hidden" id="old-post-format" value="<?php echo esc_attr( $post_format ); ?>" />
33        <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>
34-       <?php foreach ( $post_formats[0] as $format ) : ?>
35+       <?php foreach ( $post_formats as $format ) : ?>
36+       <?php if( $format !== 0 ) : ?>
37        <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>
38+       <?php endif; ?>
39        <?php endforeach; ?><br />
40        <p>
41         <a href="#post-formats" class="save-post-format hide-if-no-js button"><?php _e('OK'); ?></a>