Opened 7 years ago
Last modified 6 months ago
#42751 new defect (bug)
Can we please enqueue media-views independently ?
Reported by: | Themezly | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Media | Keywords: | phase-3-media-triage |
Focuses: | administration | Cc: |
Description
Many of theme developers are styling mediaelement to their preference and this is a first step when they do so;
/* * use theme mediaelement CSS */ wp_deregister_style('mediaelement'); wp_deregister_style('wp-mediaelement');
that disables the default CSS and lets us use our own. Issue with this is that
buttons, imgareaselect and media-views CSS files depend on these and if anyone is using a frontend page builder or anything that needs media library in frontend, these 3 CSS files are not present.
My first tought was
/* * since we have deregistered medialement style * make sure media dependencies are loaded * in case of frontend editros */ if( is_user_logged_in() ){ wp_enqueue_style( 'buttons' ); wp_enqueue_style( 'imgareaselect' ); wp_enqueue_style( 'media-views' ) ; }
but to my surprise media-views which is a key CSS file for media library is not loading since it is a dependent.
I know that I can do the direct enque but since we have a handle we should be able to use it independently from other styles.
While we are at it, why are we loading mediaelement CSS files at the bottom of body
CSS files should always be in head.
a search found about 20 themes that deregistered the styles