diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index c652ae7cca..ebe7550dc6 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -56,7 +56,7 @@ $core_actions_post = array( 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor', - 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'show-post-format-ui', + 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', ); // Register core Ajax calls. diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index cebebfc59a..b2655b8ee1 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -95,39 +95,6 @@ if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_ $post_format = 'standard'; $admin_body_class .= ' wp-format-' . $post_format; - - $show_post_format_ui = false; - - if ( apply_filters( 'enable_post_format_ui', true, $post ) ) { - - // If the user has explicitly set a screen option, use it, otherwise the UI is shown - // when the theme supports formats, or if the site has formats assigned to posts. - $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type ); - if ( false !== $post_format_user_option ) - $show_post_format_ui = (bool) $post_format_user_option; - else - $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) ); - - if ( ! $show_post_format_ui ) { - $meta = get_post_format_meta( $post->ID ); - $format_meta_keys = array( - 'link' => array( 'linkurl' ), - 'image' => array( 'url', 'image' ), - 'quote' => array( 'quote_source_name', 'quote_source_url' ), - 'video' => array( 'video_embed' ), - 'audio' => array( 'audio_embed' ), - ); - - // If there's any structured post format data, enforce the UI display. - $format_meta_keys = isset( $format_meta_keys[ get_post_format() ] ) ? $format_meta_keys[ get_post_format() ] : array(); - foreach ( $format_meta_keys as $key ) - if ( ! empty( $meta[ $key ] ) ) - $show_post_format_ui = true; - } - } - - if ( $show_post_format_ui ) - $admin_body_class .= ' wp-post-format-show-ui'; } if ( wp_is_mobile() ) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 39d7103627..3e485f24af 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -112,6 +112,9 @@ if ( 'attachment' == $post_type ) { add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' ); } +if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) + add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); + // all taxonomies foreach ( get_object_taxonomies( $post ) as $tax_name ) { $taxonomy = get_taxonomy($tax_name); @@ -126,73 +129,6 @@ foreach ( get_object_taxonomies( $post ) as $tax_name ) { add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); } -// post format -$format_class = ''; -$post_format = ''; -$post_format_options = ''; -if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) { - wp_enqueue_script( 'post-formats' ); - wp_enqueue_script( 'wp-mediaelement' ); - wp_enqueue_style( 'wp-mediaelement' ); - $post_format = get_post_format(); - - if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) - $post_format = $_REQUEST['format']; - - if ( ! $post_format ) - $post_format = 'standard'; - - $format_class = " class='wp-format-{$post_format}'"; - - $all_post_formats = array( - 'standard' => array ( - 'description' => __( 'Use the editor below to compose your post.' ) - ), - 'image' => array ( - 'description' => __( 'Select or upload an image for your post.' ) - ), - 'gallery' => array ( - 'description' => __( 'Use the Add Media button to select or upload images for your gallery.' ) - ), - 'link' => array ( - 'description' => __( 'Add a link title and destination URL. Use the editor to compose optional text to accompany the link.' ) - ), - 'video' => array ( - 'description' => __( 'Select or upload a video, or paste a video embed code into the box.' ) - ), - 'audio' => array ( - 'description' => __( 'Select or upload an audio file, or paste an audio embed code into the box.' ) - ), - 'chat' => array ( - 'description' => __( 'Copy a chat or Q&A transcript into the editor.' ) - ), - 'status' => array ( - 'description' => __( 'Use the editor to compose a status update. What’s new?' ) - ), - 'quote' => array ( - 'description' => __( 'Add a source name and link if you have them. Use the editor to compose the quote.' ) - ), - 'aside' => array ( - 'description' => __( 'Use the editor to share a quick thought or side topic.' ) - ) - ); - - foreach ( $all_post_formats as $slug => $attr ) { - $class = ''; - if ( $post_format == $slug ) { - $class = 'class="active"'; - $active_post_type_slug = $slug; - } - - $url = add_query_arg( 'format', $slug ); - - $post_format_options .= '' . ucfirst( $slug ) . ''; - } - - $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) ); - wp_localize_script( 'post-formats', 'postFormats', $current_post_format ); -} - if ( post_type_supports($post_type, 'page-attributes') ) add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); @@ -379,13 +315,7 @@ if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
- -