From 5b7e9c8a1c29a5e59ca99aa458b6143491580b6c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 17 May 2013 15:12:50 +0000 Subject: [PATCH] Display the post format UI when there is structured data associated with the post regardless of the screen option. Props kovshenin see #24327 git-svn-id: http://core.svn.wordpress.org/trunk@24282 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-header.php | 17 +++++++++++++++++ wp-admin/includes/screen.php | 35 +++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 473155f299..5372a865c6 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -107,6 +107,23 @@ if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_ $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 ) diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 0f6c4dd2ba..f66249cdbf 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -936,6 +936,7 @@ final class WP_Screen { $columns = get_column_headers( $this ); $hidden = get_hidden_columns( $this ); + $post = get_post(); ?>