WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add fields to Attachment Details (8 posts)

  1. Patrick Hesselberg
    Member
    Posted 1 year ago #

    Hi,

    Is there any way to add more fields to Attachment details inside the media uploader? Seems pretty closed off and there are no hooks inside:

    wp-includes/media.php, line 1600

    <h3><?php _e('Attachment Details'); ?></h3>
    <div class="attachment-info">
    	<div class="thumbnail">
    		<# if ( data.uploading ) { #>
    			<div class="media-progress-bar"><div></div></div>
    		<# } else if ( 'image' === data.type ) { #>
    			<img src="{{ data.size.url }}" draggable="false" />
    		<# } else { #>
    			<img src="{{ data.icon }}" class="icon" draggable="false" />
    		<# } #>
    	</div>
    	<div class="details">
    		<div class="filename">{{ data.filename }}</div>
    		<div class="uploaded">{{ data.dateFormatted }}</div>
    		<# if ( 'image' === data.type && ! data.uploading ) { #>
    			<div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
    		<# } #>
    	</div>
    	<div class="compat-meta">
    		<# if ( data.compat && data.compat.meta ) { #>
    			{{{ data.compat.meta }}}
    		<# } #>
    	</div>
    </div>
  2. keesiemeijer
    moderator
    Posted 1 year ago #

  3. Patrick Hesselberg
    Member
    Posted 1 year ago #

    Oh same hooks. Smart..

    Sorry for this silly question and thanks alot.

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    No problem :-)

    By the way: not a silly question.

  5. LinusOnTheLine
    Member
    Posted 11 months ago #

    I bump this thread with another question;

    Does anyone knows how to add an extra filed to the "Gallery Settings" here, for example give it a name, so that it will greate a gallery string like
    [gallery link="file" ids="1,2,3" name="My gallery"] ?

  6. Patrick Hesselberg
    Member
    Posted 11 months ago #

    Check out the post_gallery hook.

  7. LinusOnTheLine
    Member
    Posted 11 months ago #

    Patrick, if that answer was to me, I can only find info about how to get the setting "name", not how to create a textfield for adding it.
    Or even how to add that custom textfield. I can get fields to appear for the image settings, not for the gallery.

    Maybe i'm just stupid, and/or my googeling skills are terrible.

Topic Closed

This topic has been closed to new replies.

About this Topic