Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can i change those editing inputs to title from caption? wp3.5 gallery edit

Some sources i found about new upload system:

Basically looking for a proper solution like this:

// http://wordpress.org/support/topic/wp-35-any-way-to-default-add-media-to-upload-files#post-3709109
// If you want to have the editor default to the Upload Files tab in the admin editor
add_action( 'admin_footer-post-new.php', 'idealien_mediaDefault_script' );
add_action( 'admin_footer-post.php', 'idealien_mediaDefault_script' );
function idealien_mediaDefault_script()
{
    ?>
<script type="text/javascript">
jQuery(document).ready(function($){
    wp.media.controller.Library.prototype.defaults.contentUserSetting = false; // making editor default to the Upload Files

});
</script>
<?php } 
share|improve this question
1  
Have you done any research? What have you tried so far? –  s_ha_dum Feb 20 '13 at 19:33
    
I spent lots of hours to understand new wp media gallery modal system but it is using backbone.js and most of guides are about creating custom upload buttons, not changing default one. Thanks for -1 btw.. I still believe its a good question –  Ünsal Korkmaz Feb 20 '13 at 19:43
    
If i had any clue on solution for the problem, believe me i would share. Just check my previous questions. I explained solutions when i find it. I simply stucked because wp-admin files still includes previous media uploader codes and "attachment_fields_to_edit" or lots of old filters/actions simply not effecting to new uplaod system. I only found this: mikejolley.com/2012/12/… but its only js and there is no explanation on how to use it –  Ünsal Korkmaz Feb 20 '13 at 20:03
    
Started bounty. Maybe it helps ^^ –  Ünsal Korkmaz Feb 23 '13 at 10:25
    
Don't know if helps, but check this. What I've seen is that all topics related to the new Media Manager were met with silence in [wp-hackers]. I suppose we'll only have proper hooks and documentation around 3.6, if not 3.7 :/ –  brasofilo Feb 25 '13 at 12:08
show 1 more comment

2 Answers

up vote 3 down vote accepted

I explained solution here: http://unsalkorkmaz.com/wp3-5-media-gallery-edit-modal-change-captions-to-title/

If you want just solution:

add_action( 'admin_footer-post-new.php', 'firmasite_replace_script_tmpl_attachment' );
add_action( 'admin_footer-post.php', 'firmasite_replace_script_tmpl_attachment' );
function firmasite_replace_script_tmpl_attachment()
{ ?>
    <script type="text/javascript">
        jQuery(document).ready(function($){
            jQuery("script#tmpl-attachment:first").remove();
        });
    </script>
    <script type="text/html" id="tmpl-attachment">
        <div class="attachment-preview type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
            <# if ( data.uploading ) { #>
                <div class="media-progress-bar"><div></div></div>
            <# } else if ( 'image' === data.type ) { #>
                <div class="thumbnail">
                    <div class="centered">
                        <img src="{{ data.size.url }}" draggable="false" />
                    </div>
                </div>
            <# } else { #>
                <img src="{{ data.icon }}" class="icon" draggable="false" />


        <div class="filename">
                <div>{{ data.filename }}</div>
            </div>
        <# } #>

        <# if ( data.buttons.close ) { #>
            <a class="close media-modal-icon" href="#" title="<?php _e('Remove'); ?>"></a>
        <# } #>

        <# if ( data.buttons.check ) { #>
            <a class="check" href="#" title="<?php _e('Deselect'); ?>"><div class="media-modal-icon"></div></a>
        <# } #>
    </div>
    <#
    var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
    if ( data.describe ) { #>
        <# if ( 'image' === data.type ) { #>
            <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
                placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
        <# } else { #>
            <input type="text" value="{{ data.title }}" class="describe" data-setting="title"
                <# if ( 'video' === data.type ) { #>
                    placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
                <# } else if ( 'audio' === data.type ) { #>
                    placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
                <# } else { #>
                    placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
                <# } #> {{ maybeReadOnly }} />
        <# } #>
    <# } #>
</script>

share|improve this answer
add comment

You can deactivate the default gallery, the shortcode via hook. Also add a new function for the shortcode gallery and copz, paste from original aand change the input for caption. Put all source in a plugin. If WordPress change this in a next version, then deactivate your plugin or change it. I think it is the best solution without change the input on media manager.

share|improve this answer
    
i updated question. Looking for a solution like adding wp.media.controller.Library.prototype.defaults.contentUserSetting = false; –  Ünsal Korkmaz Feb 21 '13 at 0:08
    
But the title is not the default on the gallery. If you will, that the user can't change this, then hide the parts in the media window and change the shortcode function for gallery, use alwys the title for images inside the gallery. –  bueltge Feb 21 '13 at 7:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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