| 68 | |
| 69 | // Post formats |
| 70 | if ( current_theme_supports( 'post-formats' ) && isset( $_POST['post_format'] ) ) { |
| 71 | $post_formats = get_theme_support( 'post-formats' ); |
| 72 | if ( is_array( $post_formats ) ) { |
| 73 | $post_formats = $post_formats[0]; |
| 74 | if ( in_array( $_POST['post_format'], $post_formats ) ) |
| 75 | set_post_format( $post_ID, $_POST['post_format'] ); |
| 76 | elseif ( '0' == $_POST['post_format'] ) |
| 77 | set_post_format( $post_ID, false ); |
| 78 | } |
| 79 | } |
| 80 | |
| 497 | <?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) : |
| 498 | $post_formats = get_theme_support( 'post-formats' ); |
| 499 | if ( is_array( $post_formats[0] ) ) : |
| 500 | $default_format = get_option( 'default_post_format', '0' ); |
| 501 | ?> |
| 502 | <p> |
| 503 | <label for="post_format"><?php _e( 'Post Format:' ); ?> |
| 504 | <select name="post_format" id="post_format"> |
| 505 | <option value="0"><?php _e( 'Standard' ); ?></option> |
| 506 | <?php foreach ( $post_formats[0] as $format ): ?> |
| 507 | <option<?php selected( $default_format, $format ); ?> value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option> |
| 508 | <?php endforeach; ?> |
| 509 | </select></label> |
| 510 | </p> |
| 511 | <?php endif; endif; ?> |