Last active
November 9, 2017 13:32
-
-
Save axxe16/50a40377fb34e29a8ecff36b14467c15 to your computer and use it in GitHub Desktop.
Nella media library nella vista lista aggiunge la colonna con le risoluzioni delle immagini #colonne #customize #media #library *WPM*
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
add_filter('manage_upload_columns', 'size_column_register'); | |
function size_column_register($columns) { | |
$columns['dimensions'] = 'Dimensions'; | |
return $columns; | |
} | |
add_action('manage_media_custom_column', 'size_column_display', 10, 2); | |
function size_column_display($column_name, $post_id) { | |
if( 'dimensions' != $column_name || !wp_attachment_is_image($post_id)) return; | |
list($url, $width, $height) = wp_get_attachment_image_src($post_id, 'full'); | |
echo esc_html("{$width}×{$height}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment