Wordpress не отображает пользовательские параметры размера изображения в медиа-лайтбоксе, но вы можете добавить их, используя фильтр attachment_fields_to_edit
. Ниже будут добавлены параметры для всех пользовательских размеров изображений, которые вы определили.
add_filter('attachment_fields_to_edit', 'my_attachment_fields_to_edit_filter', 100, 2);
function my_attachment_fields_to_edit_filter($form_fields, $post) {
if (!array_key_exists('image-size', $form_fields)) return $form_fields;
global $_wp_additional_image_sizes;
foreach($_wp_additional_image_sizes as $size => $properties) {
if ($size == 'post-thumbnail') continue;
$label = ucwords(str_replace('-', ' ', $size));
$cssID = "image-size-{$size}-{$post->ID}";
$downsize = image_downsize($post->ID, $size);
$enabled = $downsize[3];
$html = '<input type="radio" ' . disabled($enabled, false, false) . 'name="attachments[' . $post->ID. '][image-size]" id="' . $cssID . '" value="' . $size .'">';
$html .= '<label for="'. $cssID . '">' . $label . '</label>';
if ($enabled) $html .= ' <label for="' . $cssID . '" class="help">(' . $downsize[1] . ' × ' . $downsize[2] . ')</label>';
$form_fields['image-size']['html'] .= '<div class="image-size-item">' . $html . '</div>';
}
return $form_fields;
}