• Displays non-editable attachment metadata in the publish metabox

    Signature:
    attachment_submitbox_metadata
    Return:
    (void)
    Source
    function attachment_submitbox_metadata() {
    $post = get_post();

    $filename = esc_html( basename( $post->guid ) );

    $media_dims = ”;
    $meta = wp_get_attachment_metadata( $post->ID );
    if ( is_array( $meta ) && array_key_exists( ‘width’, $meta ) && array_key_exists( ‘height’, $meta ) )
    $media_dims .= “<span id=’media-dims-$post->ID’>{$meta[‘width’]} × {$meta[‘height’]}</span> “;
    $media_dims = apply_filters( ‘media_meta’, $media_dims, $post );

    $att_url = wp_get_attachment_url( $post->ID );
    ?>
    <div class=”misc-pub-section”>
    <label for=”attachment_url”><?php _e( ‘File URL:’ ); ?></label>
    <input type=”text” class=”widefat urlfield” readonly=”readonly” name=”attachment_url” value=”<?php echo esc_attr($att_url); ?>” />
    </div>
    <div class=”misc-pub-section”>
    <?php _e( ‘File name:’ ); ?> <?php echo $filename; ?>
    </div>
    16 more lines…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘attachment_submitbox_metadata’ is closed to new replies.