WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/15/2013 08:43:09 PM (8 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/edit-form-advanced.php

    r24184 r24264  
    131131$post_format = '';
    132132$post_format_options = '';
    133 $show_post_format_ui = false;
    134133if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) {
    135134    wp_enqueue_script( 'post-formats' );
     
    143142        if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
    144143            $post_format = $_REQUEST['format'];
    145     }
    146 
    147     $user_wants = get_user_option( 'post_formats_' . $post_type );
    148     if ( false !== $user_wants ) {
    149         // User wants what user gets.
    150         $show_post_format_ui = (bool) $user_wants;
    151     } else {
    152         // UI is shown when the theme supports formats, or if the site has formats assigned to posts.
    153         $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) );
    154144    }
    155145
     
    390380</div>
    391381<?php if ( ! empty( $post_format_options ) ) : ?>
    392 <div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
     382<div class="wp-post-format-ui">
    393383    <div class="post-format-options">
    394384        <?php echo $post_format_options; ?>
     
    423413<div id="post-body-content"<?php echo $format_class; ?>>
    424414<?php if ( ! empty( $all_post_formats ) ) : ?>
    425 <div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
     415<div class="wp-post-format-ui">
    426416    <div class="post-format-change"><span class="icon <?php echo esc_attr( 'wp-format-' . $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span></div>
    427417</div>
Note: See TracChangeset for help on using the changeset viewer.