schoe
Forum Replies Created
-
Forum: Plugins
In reply to: Removing options in upload tableI also tried flexible-upload.
For my needs WP 2.6 + photojar has the same functionality
… and is much easier to change/hack!Forum: Plugins
In reply to: TDO Mini forms widget problemForum: Plugins
In reply to: Removing options in upload table… in addition to my last message:
I definitly know that it works in WP 2.6 if you place the code in the nice little upload plugin “photojar-base”!
Michael
Forum: Plugins
In reply to: Removing options in upload tableHi rn2web
I’m not a professionel but as far as I know
- you should better not try to hack WP. Changing anything in wp-admin or in wp-includes is a hack!
- If you place it in your themes functions.php you might also need one or both of the following lines:
include_once('wp-config.php'); include_once('wp-includes/wp-db.php'); - It should work without errors if you put it in a standard plugin. Perhaps you could try to put it in the example plugin hello.php in “wp-content/plugins/”.
… and then activate it – of course!
good luck!
Michael
Forum: Plugins
In reply to: Removing options in upload tableTo remove the first two option lines you can add the following lines to the functions.php of your theme (or to another plugin you have installed):
function ms_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { // align: (radio) $form_fields['align']['value'] = 'aligncenter'; $form_fields['align']['input'] = 'hidden'; // image-size: (radio) $form_fields['image-size']['value'] = 'thumbnail'; $form_fields['image-size']['input'] = 'hidden'; } return $form_fields; } add_filter('attachment_fields_to_edit', 'ms_attachment_fields_to_edit', 11, 2);The third option line seems to be inserted by another plugin you are using. To remove it, search for
<input type="radio" ...>
in its php-files and add the corresponding lines to the above function.Works for me at least 🙂
Michael
Forum: Plugins
In reply to: attachment fields as image meta data?Just in case anybody is interested:
The corect hook – of course – is attachment_fields_to_savefunction ms_image_attachment_fields_to_save($post, $attachment) { if ( substr($post['post_mime_type'], 0, 5) == 'image' ) { $post_id = $post['ID']; $meta = wp_get_attachment_metadata( $post_id ); $meta['image_meta']['Homepage'] = $attachment['homepage']; wp_update_attachment_metadata( $post_id, $meta ); } return $post; } add_filter('attachment_fields_to_save', 'ms_image_attachment_fields_to_save', 11, 2);If you know it’s rather simple 🙂
Michael
Forum: Plugins
In reply to: attachment fields as image meta data?Sorry, that seems to be the correct code snipet to get the extra field displayed in the upload form:
function ms_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['homepage'] = array( 'label' => __('Homepage'), 'input' => 'html', 'html' => " <input type='text' name='attachments[$post->ID][homepage]' id='attachments[$post->ID][homepage]' size='50' value='http://' /><br />", } return $form_fields; ); add_filter('attachment_fields_to_edit', 'ms_attachment_fields_to_edit', 11, 2);… but I just can’t find the HOOK to get it stored as meta_value in the wp_postmeta!
Anybody who can help ???
Michael
Forum: Plugins
In reply to: attachment fields as image meta data?OK, it’s a plugin like “photojar-base” which I prefer,
adding something like:function ms_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['image-meta'] = array( 'label' => __('Homepage:'), 'input' => 'html', 'html' => " <input type='text' name='attachments[$post->ID][image-meta][homepage]' id='attachments[$post->ID][image-meta][homepage]' size='50' value='http://xyz.de' />" ); } return $form_fields; } add_filter('attachment_fields_to_edit', 'ms_attachment_fields_to_edit', 11, 2);Homepage will show in the upload form but is not stored as meta_value in the wp_postmeta.
Obviously I need another hook. Any ideas?Michael