• If you use the playlist shortcode, WP intializes the MEJS playlist interface with wp-playlist.js. At the end of this file, you have this:

    $(document).ready(function () {
    		$('.wp-playlist').each( function() {
    			return new WPPlaylistView({ el: this });
    		} );
        });

    So the resulting objects get tossed into the abyss. How can I get this object and access its methods (and the attached MEJS player element)? Or is this worthy of a support ticket to attach these to the window somehow?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You can simply make your own version of wp-playlist.js. Deregister the “wp-playlist” script and register your version instead using the same tag. Once registered, the playlist shortcode will enqueue and use your version instead.

    Deregister/register in a callback hooked to “wp_enqueue_scripts”. Add your callback with a large priority number so it is not executed until WP has a chance to register the default version so there is actually something to deregister.

    Thread Starter eclev91

    (@eclev91)

    Yeah, this was my fallback plan. I feel like core should somehow expose this out of the box, though. Perhaps worth a trac ticket for more feedback?

    Moderator bcworkz

    (@bcworkz)

    That would be up to you ?? Since the function does what it’s supposed to, it’s not a bug, but enhancement requests are accepted too. I don’t think it’s unreasonable to expose other elements for plugin access while it’s doing what it is supposed to do. If you are able to provide a patch file and unit tests with your ticket, your request is more likely get some traction, but don’t let that deter you if you cannot do so.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get the MEJS element from the playlist shortcode’ is closed to new replies.