How do I create a custom add media button modal?

Question

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
, , , , jermspeaks 5 years 0 Answers 86 views 0

Leave an answer