Hi architecb33!
Sounds like You are using DG a lot if one additional click matters to You that much ?? Main idea behind current design was not to overload users with excessive controls and not to increase (typical for software world) multitude of possible ways to accomplish same task.
We’ll look into Your request, maybe we would introduce it like an option (to activate under advanced settings) for users with extensive usage of DG.
For now we can suggest You to play around and test this mod.
To use this code You should paste it to the functions.php file of Your active WordPress theme, this can be done either using Dashboard -> Appearance -> Editor -> Theme Functions
(for the active theme), or through FTP.
function dg_specific_button_js() { ?>
<script type="text/javascript">
function open_dg_tab() {
if ( this.frame === undefined ) {
if ( wp.media.frame !== undefined && jQuery.inArray(wp.media.frame.state().id, ['dg', 'dg-edit', 'dg-library'])<0 ) {
wp.media.frame.setState('dg');
}
var options = {
frame: 'post',
state: 'dg',
title: DGl10n.dgMenuTitle,
multiple: true
};
this.frame = wp.media.editor.open(null, options);
} else {
if ( jQuery.inArray(this.frame.state().id, ['dg', 'dg-edit', 'dg-library'])<0 ) {
this.frame.setState('dg');
}
this.frame.open();
}
return false;
}
jQuery(document).ready( function() {
if ( typeof wp.media.collection !== 'function' ) return;
jQuery('#dg-specific-button').removeAttr('disabled').click(open_dg_tab);
} );
</script>
<?php }
function dg_check_page_type( $hook ) {
if ( in_array( $hook, array( 'post.php', 'post-new.php' ), true ) ) {
function dg_add_specific_button() {
echo '<button id="dg-specific-button" class="button" disabled>'.__( 'Create Document Gallery', 'document-gallery' ).'</button>';
}
add_action('media_buttons', 'dg_add_specific_button');
add_action('admin_print_footer_scripts', 'dg_specific_button_js');
}
}
add_action('admin_enqueue_scripts', 'dg_check_page_type');
Hope this will bring the wanted performance.
Please don’t hesitate to let us know if You run into any further issues and feel free to give us some feedback ??