[theme-reviewers] Deregistering mediaelement style / script

Otto otto at ottodestruct.com
Thu Apr 10 23:29:20 UTC 2014


Only if you need to replace the whole thing. If you only need to make minor
adjustments to portions of it, using CSS specificity is simpler and quicker.

-Otto


On Thu, Apr 10, 2014 at 6:18 PM, Chip Bennett <chip at chipbennett.net> wrote:

> You know what, I'm going to contradict myself. The cleanest way to
> wholesale override the mediaelement playlist CSS is to deregister the core
> style, and enqueue your own. Something like so:
>
> /**
>  * Function action to override playlist CSS
>  */
> function themeslug_override_playlist_style() {
> wp_dequeue_style( 'wp-mediaelement' );
>  wp_enqueue_style( 'themeslug-mediaelement', $url );
> }
> add_action( 'wp_playlist_scripts', 'themeslug_override_playlist_style', 11
> );
>
> Now, if you just need to filter the "skins" (default are "dark" and
> "light"), to add a custom skin, that's filterable, and should be done via
> filter. But if a Theme needs/wants to override the CSS completely, I don't
> have a huge problem with it.
>
> I dug quite a bit, looking for a better way to filter; but I didn't find
> anything. Maybe wp_add_inline_style() could be useful?
>
>
> On Thu, Apr 10, 2014 at 7:05 PM, Justin Tadlock <justin at justintadlock.com>wrote:
>
>> In general, I don't recommend disabling the JavaScript (that's probably
>> always plugin territory), but the CSS is fine in many cases.  Presentation
>> of content is entirely within the theme's domain.
>>
>> I even have a project for handling custom styling of the media player:
>> https://github.com/justintadlock/theme-mediaelement
>>
>> Demo:
>> http://locallylost.com/socially-awkward/2013/09/02/big-buck-bunny/
>>
>> This is referring to overwriting the entire stylesheet with a custom one.
>>  I like to mix it with Genericons instead of the images packaged with WP.
>>  There's no need to load WP's stylesheets (two of them) when completely
>> customizing the player's design.
>>
>> Just to overwrite some minor things, all that's needed is a bit of CSS in
>> a theme's `style.css`.
>>
>>
>> On 4/10/2014 2:32 PM, Afzaal wrote:
>>
>>> Hi,
>>>
>>> I'm currently reviewing a theme where the author is deregistering a
>>> WordPress bundled stylesheet "wp-mediaelement". This is being done within a
>>> custom theme class and immediately the authors own stylesheet is being
>>> registered.
>>>
>>> Is there any problems with doing this? I know that deregistering some
>>> scripts such as jQuery are not allowed, so thought it best to ask.
>>>
>>> Thanks,
>>>
>>> Afzaal
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140410/a7346e60/attachment-0001.html>


More information about the theme-reviewers mailing list