From 9d531ae545bc7dc6c718df96c9b9d3cb10ad273f Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 25 Apr 2013 02:44:23 +0000 Subject: [PATCH] post-new.php?format=X will pre-fill the format, to allow for Post-Format-chosen-first editor jump-starting. props kovshenin, wonderboymusic. fixes #24116. git-svn-id: https://develop.svn.wordpress.org/trunk@24081 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-form-advanced.php | 5 ++++- wp-admin/includes/screen.php | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 09e9706f7e..801072a6bc 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -139,7 +139,10 @@ if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_ if ( ! $post_format ) { $post_format = 'standard'; - if ( 'auto-draft' == $post->post_status ) + + if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) + $post_format = $_REQUEST['format']; + elseif ( 'auto-draft' == $post->post_status ) $post_format_set_class = ''; } diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 5ea232ca8d..4fd4519031 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -148,7 +148,6 @@ function screen_icon( $screen = '' ) { * @return string HTML for the screen icon. */ function get_screen_icon( $screen = '' ) { - global $post_ID; if ( empty( $screen ) ) $screen = get_current_screen(); elseif ( is_string( $screen ) ) @@ -168,10 +167,13 @@ function get_screen_icon( $screen = '' ) { if ( $screen->post_type ) $class .= ' ' . sanitize_html_class( 'icon32-posts-' . $screen->post_type ); - if ( $post_ID ) { - $format = get_post_format( $post_ID ); - if ( $format ) - $class .= ' wp-format-' . $format; + if ( 'post' == $screen->id ) { + $post_format = get_post_format(); + if ( ! $post_format && ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) + $post_format = $_REQUEST['format']; + + if ( $post_format ) + $class .= ' wp-format-' . $post_format; } }