这是个好主意。感谢您建议使用它。:)
您可以向媒体库中添加一列以输出路径。这会把他们全都吐出来。当然,您可以过滤它,只显示您实际需要的大小。加入functions.php
或类似。
// Adds a "Sizes" column
function sizes_column( $cols ) {
$cols["sizes"] = "Sizes";
return $cols;
}
// Fill the Sizes column
function sizes_value( $column_name, $id ) {
if ( $column_name == "sizes" ) {
// Including the direcory makes the list much longer
// but required if you use /year/month for uploads
$up_load_dir = wp_upload_dir();
$dir = $up_load_dir[\'url\'];
// Get the info for each media item
$meta = wp_get_attachment_metadata($id);
// and loop + output
foreach ( $meta[\'sizes\'] as $name=>$info) {
// could limit which sizes are output here with a simple if $name ==
echo "<strong>" . $name . "</strong><br>";
echo "<small>" . $dir . "/" . $info[\'file\'] . " </small><br>";
}
}
}
// Hook actions to admin_init
function hook_new_media_columns() {
add_filter( \'manage_media_columns\', \'sizes_column\' );
add_action( \'manage_media_custom_column\', \'sizes_value\', 10, 2 );
}
add_action( \'admin_init\', \'hook_new_media_columns\' )
使用
<small>
作为一种快速而肮脏的黑客,可以控制长URL的大小。在制作中,我可能会把这个
<dl>
并通过站点插件添加一些管理CSS来调整其显示。