Created
January 27, 2013 10:52
-
-
Save maor/4647839 to your computer and use it in GitHub Desktop.
Adds a new row that shows the file size under an individual attachment dashboard page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds a new row that shows the file size under an individual attachment dashboard page | |
* | |
* @author Maor Chasen | |
*/ | |
function mc_attachment_submitbox_filesize() { | |
$post = get_post(); | |
$filesize = @filesize( get_attached_file( $post->ID ) ); | |
if ( ! empty( $filesize ) && is_numeric( $filesize ) && $filesize > 0 ) : ?> | |
<div class="misc-pub-section"> | |
<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $filesize ); ?></strong> | |
</div> | |
<?php | |
endif; | |
} | |
add_action( 'attachment_submitbox_misc_actions', 'mc_attachment_submitbox_filesize' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment