Skip to content

Commit 999f022

Browse files
committed
Media: Add download link to media modal and attachment details.
Make it easier for users to download their uploaded media by providing a download link on the attachment details screen and in the media modal. Props countrymusicchicago, joedolson, amin7 Fixes #41474. git-svn-id: https://develop.svn.wordpress.org/trunk@55156 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1b1fa72 commit 999f022

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/wp-admin/includes/media.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,6 +3336,9 @@ function attachment_submitbox_metadata() {
33363336
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
33373337
</span>
33383338
</div>
3339+
<div class="misc-pub-section misc-pub-download">
3340+
<a href="<?php echo esc_attr( $att_url ); ?>" download><?php _e( 'Download file' ); ?></a>
3341+
</div>
33393342
<div class="misc-pub-section misc-pub-filename">
33403343
<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
33413344
</div>

src/wp-includes/media-template.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,10 @@ function wp_print_media_templates() {
529529
<# } #>
530530
<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
531531
<# } #>
532+
<# if ( data.can.save && data.link ) { #>
533+
<span class="links-separator">|</span>
534+
<a href="{{ data.url }}" download><?php _e( 'Download file' ); ?></a>
535+
<# } #>
532536
<# if ( ! data.uploading && data.can.remove ) { #>
533537
<# if ( data.link || data.can.save ) { #>
534538
<span class="links-separator">|</span>

0 commit comments

Comments
 (0)