问题描述:

According to my this thread I finally managed to prevent Wordpress from looping and playing the next soundtracks automatically editing these lines of codes in wp-playlist.min.js :

For the next soundtracks I deleted this:

this.tracks.length?this.next():

and for the loop I changed this:

(this.index=0,this.setCurrent())}

to this:

(this.index=0)

Now I know if I upgrade my Wordpress it will reset these settings and I'm looking for a way to have it in my footer.php because there are some other modified codes inside <script type="text/javascript"> </script> that fixes some other issues...

Any help would be appreciated.

网友答案:

You can create a plugin that has a copy of wp-includes/js/mediaelement/wp-playlist.min.js in it with your chances. Then unload the other version and load this version of the file with:

add_action( 'wp_enqueue_scripts', 'my_mediaelement_changes' );
function my_mediaelement_changes() {
        wp_deregister_script( 'wp-playlist' );
        wp_register_script( 'wp-playlist', plugin_dir_path( __FILE__ ) . "/js/wp-playlist.min.js", array( 'mediaelement' ), false, true );
}
相关阅读:
Top