Advertisement
Guest User

snippet from media.php file from WordPress

a guest
Aug 25th, 2011
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. function get_attachment_fields_to_edit($post, $errors = null) {
  2. if ( is_int($post) )
  3. $post =& get_post($post);
  4. if ( is_array($post) )
  5. $post = (object) $post;
  6.  
  7. $image_url = wp_get_attachment_url($post->ID);
  8.  
  9. $edit_post = sanitize_post($post, 'edit');
  10.  
  11.  
  12.  
  13. $form_fields = array(
  14. 'post_title' => array(
  15. 'label' => __('Title'),
  16. 'value' => $edit_post->post_title
  17. ),
  18. 'image_alt' => array(),
  19. 'post_excerpt' => array(
  20. 'label' => __('Caption'),
  21. 'value' => $edit_post->post_excerpt
  22. ),
  23. 'post_content' => array(
  24. 'label' => __('Description'),
  25. 'value' => $edit_post->post_content,
  26. 'input' => 'textarea'
  27. ),
  28. 'url' => array(
  29. 'label' => __('Link URL'),
  30. 'input' => 'html',
  31. 'html' => image_link_input_fields($post, get_option('image_default_link_type')),
  32. 'helps' => __('Enter a link URL or click above for presets.')
  33. ),
  34. 'menu_order' => array(
  35. 'label' => __('Order'),
  36. 'value' => $edit_post->menu_order
  37. ),
  38. 'image_url' => array(
  39. 'label' => __('File URL'),
  40. 'input' => 'html',
  41. 'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />",
  42. 'value' => wp_get_attachment_url($post->ID),
  43. 'helps' => __('Location of the uploaded file.')
  44. )
  45. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement