Keep media title and description open while uploading media


// Check if function does not exist.
if ( ! function_exists( 'rtmedia_wp_footer_open_title_and_desc_callback' ) ) {
/**
* Add script in the wp_footer that fire just after the media is added in the rtMedia up-loader
* By default it will open the title and description box of the media
*/
function rtmedia_wp_footer_open_title_and_desc_callback() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
rtMediaHook.register( 'rtmedia_js_file_added', function( args ) {
if( typeof args == 'object' && typeof args[1] != 'undefined' && typeof args[1].id != 'undefined' ) {
var id = args[1].id;
var button_click = '#label_' + id;
setTimeout( function() {
if( jQuery( button_click ).length > 0 ){
jQuery( button_click ).trigger( 'click' );
}
}, 250 );
}
return true;
} );
});
</script>
<?php
}
}
add_action( 'wp_footer', 'rtmedia_wp_footer_open_title_and_desc_callback' );