Restore post formats to bulk editing. props azaozz, SergeyBiryukov, DrewAPicture. fixes #24096.

Built from https://develop.svn.wordpress.org/trunk@25505


git-svn-id: http://core.svn.wordpress.org/trunk@25426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Helen Hou-Sandí 2013-09-19 17:47:08 +00:00
parent 424c62b438
commit 52426794c1
2 changed files with 37 additions and 1 deletions

View File

@ -1034,6 +1034,33 @@ class WP_Posts_List_Table extends WP_List_Table {
<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
</div>
<?php
if ( $bulk && post_type_supports( $screen->post_type, 'post-formats' ) ) {
$all_post_formats = get_post_format_strings();
?>
<label class="alignleft" for="post_format">
<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
<select name="post_format">
<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
<?php
foreach ( $all_post_formats as $slug => $format ) {
?>
<option value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $format ); ?></option>
<?php
}
?>
</select></label>
<?php
}
?>
</div></fieldset>
<?php

View File

@ -324,7 +324,13 @@ function bulk_edit_posts( $post_data = null ) {
$post_IDs = array_map( 'intval', (array) $post_data['post'] );
$reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tax_input', 'post_category', 'sticky' );
$reset = array(
'post_author', 'post_status', 'post_password',
'post_parent', 'page_template', 'comment_status',
'ping_status', 'keep_private', 'tax_input',
'post_category', 'sticky', 'post_format',
);
foreach ( $reset as $field ) {
if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
unset($post_data[$field]);
@ -418,6 +424,9 @@ function bulk_edit_posts( $post_data = null ) {
else
unstick_post( $post_ID );
}
if ( isset( $post_data['post_format'] ) )
set_post_format( $post_ID, $post_data['post_format'] );
}
return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );