Fix showing and hiding of UI elements when disabling the Post Formats UI, props kovshenin, see #24327

git-svn-id: http://core.svn.wordpress.org/trunk@24264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2013-05-15 20:43:09 +00:00
parent cf47737813
commit 7255abb66c
5 changed files with 37 additions and 22 deletions

View File

@@ -95,6 +95,22 @@ if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_
}
$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 )
$admin_body_class .= ' wp-post-format-show-ui';
}
if ( wp_is_mobile() )