Add media library column with image width and height
wordpress snippet
Adding this snippet to the functions.php of your wordpress theme will add a new column to the media library that will display the images width and height.
( example screenshot )snippet : PHPcopy
function wh_column( $cols ) {
$cols["dimensions"] = "Dimensions (w, h)";
return $cols;
}
function wh_value( $column_name, $id ) {
$meta = wp_get_attachment_metadata($id);
if(isset($meta['width']))
echo $meta['width'].' x '.$meta['height'];
}
add_filter( 'manage_media_columns', 'wh_column' );
add_action( 'manage_media_custom_column', 'wh_value', 10, 2 );
this months featured snippets
- MatthewJ
- http://wpsnipp.com Kevin Chard
- MatthewJ
- http://wpsnipp.com Kevin Chard
- Andrea Bersi
- http://funwithtp.com tpflanz











