WordPress core handles the enqueuing of the MediaElement.js scripts and styles automatically when the shortcode is used:
From wp_video_shortcode()
…
/**
* Filters the media library used for the video shortcode.
*
* @since 3.6.0
*
* @param string $library Media library used for the video shortcode.
*/
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
The code above shows that the MediaElement.js JavaScript is added to the header, since that’s how things are handled by wp_enqueue_script()
by default.
Related Posts:
- How to make native video player full width?
- Divi – How can we show background video on mobile
- How to load mediaelement.js in theme template?
- WordPress API Menu/Submenu Order
- What is the difference between wp_register_sidebar_widget and register_widget?
- What WP folder can I use to write files to?
- Form Submitting Error with get_template_part()
- Get 10 posts from a WP_Query. If less than 10, get the remainder from elsewhere
- Can’t get staging site to display same way as live site. Completely stumped
- How Do I Programmatically Force Custom Permalinks with My Theme?
- Display a different theme for not logged-in users
- how to test a theme upgrade
- Best practice (forward compatibility) for theme options
- How to use Plupload in themes
- How to add paging to query
- what’s meaning of it when submit a theme?
- How to Modify a Widgets UL and/or LI Classes
- How to remove menus section from WordPress theme customizer
- Returning Variables back into a template
- How to handle thumbnails
- How to add custom template tag in wordpress theme?
- Doubled titles when using All in One SEO with custom template
- In theme development, are there functions which write HTML in a standard fashion to reduce “spaghetti code”?
- Checking if there is an Image inserted – if not don’t display anything
- What page should I use for a contact form?
- Get attachments by user
- Retrieve data using wpdb to use for customizer controls
- Appending a value to metabox before and after saving
- Modify the Additional CSS section (adding a disclaimer)
- I made a my own theme to WordPress and Admin Menu missing from frontend
- Creating directory and file using native wordpress file system
- Don’t understand why theming is so strange and twisted [closed]
- What program can I use to preview my wordpress site?
- I want edit_post_link() to open in a new window/tab (target=”_blank”)
- How to remove a file included in parent theme with locate_template() via child theme?
- Can’t override template file in child theme
- How to store functions in… functions.php?
- Simple way to get two language WP site
- get_page_template returning nothing
- How can i initialize a widgetized sidebar (with widgets)
- How do you force a sidebar widget to have a container div around all child widgets?
- Add widgets to available widgets section without changing the theme?
- jQuery not available to other scripts
- Override template file i subfolders
- Does the switch_theme action run when you’re upgrading a theme?
- How to obtain the html stripped version of $category->description?
- How to make animated intro?
- StoreFront product pages: Turn the Short Description section into a kindred tab section [closed]
- How to jump to newly posted comment anchor after submit?
- WordPress get_template_part() function not working
- Best way to develop a new theme on a live site, with new content? [closed]
- Tag Page Not Listing All Posts With Tag
- Can I use WooCommerce in a headless CMS setup?
- Pagination not working on page template
- How can I prevent posts with no title showing up in my query?
- adding class to excerpt
- How can I wrap all blog posts image with
- Wordpres core-update theme renames theme folder name
- Redux Setting on custom created admin page
- Issue when posting updates/changes to wordress
- Shortcode IF statment help
- WordPress Load Only Page Text
- Bootstrap grid system is not working in my WordPress theme
- Never actually adding the action? Or do I have to call the action?
- How to hide custom sidebar on mobile
- Tiny MCE custom styles, and preview in the backend
- How can I remove image taxonomy pages from my theme and from Google?
- How can I get dynamic content on my static home page
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- WordPress 6.x / PHP 8.x deprecated warnings in development environment
- WordPress custom menu can’t show 3. level submenu
- Social-Link block not loading html on page with custom theme
- Custom Static Page to Display Blog Posts in Excerpt Non-Singular Form (is_singular not working?)
- Importing sass into underscores theme
- What is difference between add_theme_support and Theme Customization API?
- How can I fix my theme header for my CSS stylesheet?
- Alternative solution for script_loader_tag?
- Change logo url by category and in some pages
- Enqueue script for development purposes only?
- How to show Custom Field Value in Woocommerce Shop Page
- Why does the theme of secondary site load the primary one in WordPress Multisite? [closed]
- Creating a Sub Category Template
- style.css not being rendered in browser
- Get chronological page order
- Query wp_postmeta into an array based on post_id
- Theme not uploading showing maximum upload size on live site
- How to override wordpress native options with theme options
- Best way to access variables in template markup
- How do I get my theme scripts to load in a custom theme built from Bootstrap
- Problem with multiple menus in theme
- How to create multiple sidebar areas with a forloop and register_sidebars?
- How to convert that page to a wordpress template? [closed]
- Saving Permalinks Results in 403 MAMP (Windows)
- Add rel to all images in a post
- WordPress theme Modifications not showing up on live server
- Incorrect sidebar showing on WooCommerce Store page [closed]
- Which function(s) to build a paged HTML table
- white spaces on the all sides [closed]
- How to send async emails in wordpress?
- Is there any halfway decent documentation on the wp.media JS class?