-
-
Save bradyvercher/fdb883454d10816d9ff9 to your computer and use it in GitHub Desktop.
Cedaro Blog: Customizing MediaElement.js in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add an HTML class to MediaElement.js container elements to aid styling. | |
* | |
* Extends the core _wpmejsSettings object to add a new feature via the | |
* MediaElement.js plugin API. | |
*/ | |
function example_mejs_add_container_class() { | |
if ( ! wp_script_is( 'mediaelement', 'done' ) ) { | |
return; | |
} | |
?> | |
<script> | |
(function() { | |
var settings = window._wpmejsSettings || {}; | |
settings.features = settings.features || mejs.MepDefaults.features; | |
settings.features.push( 'exampleclass' ); | |
MediaElementPlayer.prototype.buildexampleclass = function( player ) { | |
player.container.addClass( 'example-mejs-container' ); | |
}; | |
})(); | |
</script> | |
<?php | |
} | |
add_action( 'wp_print_footer_scripts', 'example_mejs_add_container_class' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.example-mejs-container.mejs-container {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wp-audio-shortcode.mejs-container .mejs-controls .mejs-time-rail .mejs-time-float-corner, | |
.wp-video-shortcode.mejs-container .mejs-controls .mejs-time-rail .mejs-time-float-corner, | |
.wp-playlist.mejs-container .mejs-controls .mejs-time-rail .mejs-time-float-corner {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wp-audio-shortcode.mejs-container, | |
.wp-video-shortcode.mejs-container, | |
.wp-playlist.mejs-container {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment