0

I've created a custom media button for the admin in editing posts, but am having trouble figuring out how to create a view for the modal. I'm not trying to insert uploaded media; I'm trying to allow the user to search and insert existing videos via the API.

I've been looking at thickbox and media-views.js as examples, but have been having trouble with the configuration. Do I have to include an additional file for this view in wp-admin? Do I place a partial in the footer?

I've got the following so far.

add_action('media_buttons', 'add_media_button_wizard', 12);


public static function add_media_button_wizard()
{
    echo '<a href="display-code.php" class="button thickbox" title="Sample Title"> Sample Button</a>';
}

I'm really new to Wordpress plugin development, so if someone could point me in the right direction, that would be great. Thanks.

0


You can inspire from this tutorial here: http://www.sitepoint.com/adding-a-media-button-to-the-content-editor/

For videos you can change the library type to 'video':

function open_media_window() {
    var window = wp.media({
        title: 'Insert a media',
        library: {type: 'video'},
        multiple: false,
        button: {text: 'Insert'}
    });
}

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.