[wp-trac] [WordPress Trac] #33253: Some admin buttons not styled correctly in IE9 when not using post-thumbnails

WordPress Trac noreply at wordpress.org
Tue Aug 11 13:10:02 UTC 2015


#33253: Some admin buttons not styled correctly in IE9 when not using post-
thumbnails
-----------------------------+------------------------------
 Reporter:  kurdt_the_goat   |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Post Thumbnails  |     Version:  4.2.3
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by ZZmmrmn):

 If a post type doesn't have support for thumbnails this same issue will
 apply to just that post type. Additionally if wp_enqueue_media is called
 during the admin_enqueue_scripts hook the media library modal styles will
 break.

 '''Steps To Replicate'''
 With a clean install of 4.2.4 using the 2015 theme and viewing in IE9.
 Add to functions.php

 {{{
 register_post_type(
     'demo',
     array(
         'labels' => array(
             'name' => 'Demo Type',
             'singular_name' => 'Demo Type',
         ),
         'public' => true,
         'supports' => array( 'title', 'editor' )
     )
 );
 }}}
 The button styles on demo post edit pages will be broken.
 If we add to functions.php

 {{{
 function enqueue_media( ){
     wp_enqueue_media( );
 }
 add_filter( 'admin_enqueue_scripts', 'enqueue_media' );
 }}}
 Now the styles for the Media Library modal will be broken on demo post
 edit pages.

 '''Notes'''
 When using plugins like ACF wp_enqueue_media is called on most edit
 screens resulting in broken Media Library modals.

 wp-admin/edit-form-advanced.php calls wp_enqueue_media before
 admin_enqueue_scripts is triggered if support for thumbnails is true. This
 causes the buttons and media-view stylesheets to be loaded before the wp-
 admin stylesheet, resulting in the styles working correctly. Its when the
 buttons and media-view stylesheets are enqueued after the wp-admin
 stylesheet that things break.

 As a work around you can move the wp-admin stylesheet to the end of the
 enqueue list by adding this to functions.php

 {{{
 function filter_styles_enqueue_order( $styles ){
     if( is_admin( ) ){
         unset( $styles[ array_search( 'wp-admin', $styles ) ] );
         $styles[] = 'wp-admin';
     }
     return $styles;
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33253#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list