
< /code>
желаемый вывод < /strong> (если присутствует vimeo-id): < /p>

< /code>
Кто -нибудь может помочь с этим?/* Add custom field to attachment */
function image_attachment_add_custom_fields($form_fields, $post) {
$form_fields["vimeo-id"] = array(
"label" => __("Vimeo ID"),
"input" => "text",
"value" => get_post_meta($post->ID, "vimeo-id", true),
);
return $form_fields;
}
add_filter("attachment_fields_to_edit", "image_attachment_add_custom_fields", null, 2);
/* Save custom field value */
function image_attachment_save_custom_fields($post, $attachment) {
if(isset($attachment['vimeo-id'])) {
update_post_meta($post['ID'], 'vimeo-id', $attachment['vimeo-id']);
} else {
delete_post_meta($post['ID'], 'vimeo-id');
}
return $post;
}
add_filter("attachment_fields_to_save", "image_attachment_save_custom_fields", null , 2);
?>
Подробнее здесь: https://stackoverflow.com/questions/339 ... ages-in-wp
Мобильная версия