Thursday 30 March 2017

Extending the WordPress Media Uploader: Embed Options


When we are trying to insert a file using the WordPress Media Uploader, we will embed them. For images those are attachment display options, for videos those are embed options etc. The embed options can be used to insert something more such as a new format or similar. In this tutorial, we will now see how we can add a new field as an embed option to that part of the WordPress Media Uploader screen. I have worked on a project which required such functionality. I had to add different format for a video which would have on embed option. When it comes to images, there would be much more embed options. We are going to see how we can add new embed option and also use it for images.
Changing the WordPress Media Uploader Template
For us to be able to add new embed options, we need to change the template. This will have to be done using JavaScript by assigning new template instead of the old one. How do we do that? Let’s begin.
First, we need to add our script to the admin footer. But we will only add it when the WordPress Media script is enqueued.
Creating a new Template
The template we need to change can be found at wp-includes/media-template.php and the name of our template is tmpl-attachment-display-settings.
Source: https://managewp.org/articles/14737/extending-the-wordpress-media-uploader-embed-options




source https://williechiu40.wordpress.com/2017/03/30/extending-the-wordpress-media-uploader-embed-options/

No comments:

Post a Comment