Make WordPress Core


Ignore:
Timestamp:
05/15/2013 08:43:09 PM (13 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r24243 r24264  
    9696
    9797    $admin_body_class .= ' wp-format-' . $post_format;
     98
     99    $show_post_format_ui = false;
     100
     101    if ( apply_filters( 'enable_post_format_ui', true, $post ) ) {
     102
     103        // If the user has explicitly set a screen option, use it, otherwise the UI is shown
     104        // when the theme supports formats, or if the site has formats assigned to posts.
     105        $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type );
     106        if ( false !== $post_format_user_option )
     107            $show_post_format_ui = (bool) $post_format_user_option;
     108        else
     109            $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) );
     110    }
     111
     112    if ( $show_post_format_ui )
     113        $admin_body_class .= ' wp-post-format-show-ui';
    98114}
    99115
Note: See TracChangeset for help on using the changeset viewer.