2

I'm developing a plug-in and wanting to make a customized version of the the "Create Gallery" tab of WP v4.0, but have the resulting output (i.e. what gets inserted into the TinyMCE editor) to be different.

The user would click "Add Media", then "Create Media Gallery" on the left, then pick any files (not just image types) and click the "Insert Media Gallery" button and up with a shortcode like [media-gallery ids="3,5,8,16,24"].

enter image description here

So far, I've figured out how to create the tab:

function setup_custom_tabs_for_media_upload( $tabs ) {

    # FORMAT: tab_<TAB_ID_GOES_HERE> => This Is The Tab Label
    $tabs['tab_viewable_media'] = 'Create Media Gallery';

    # Return the tabs array
    return $tabs;
}

# TAB ADDITIONS ACTIVATION
add_filter( 'media_upload_tabs', 'setup_custom_tabs_for_media_upload' );

I've also figured out how to get some basic HTML content to show up when the "Create Media Gallery" tab is clicked:

function tab_interface_for_insert_viewable_media() {
    echo '<p>This is where I want the media-picker-thing to show up.</p>';
}

add_action( 'media_upload_tab_viewable_media', 'tab_interface_for_insert_viewable_media' );

I don't understand how to show the WordPress media-picker-thing now, nor how to get the list of selected items and return them to the TinyMCE editor inside my desired [media-gallery ids="3,5,8,16,24"] shortcode.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.