Attachments itself same as posts…
so you can think on giving tham meta_values or adding taxonomies to tham. as for me i always used first method… this is a simple example of how this functioonality works…
add_filter("attachment_fields_to_edit", "afields_to_edit", 10, 2);
add_filter("attachment_fields_to_save", "afields_to_save", 10, 2);
function afields_to_save($post, $attachment){
$parentPost = get_post($post['post_parent']);
/*************************************************************
// Roles
*************************************************************/
if (isset($_POST['___attachments'][$post['ID']]['type'])
&& trim($_POST['___attachments'][$post['ID']]['type']) != ""){
$type = $_POST['___attachments'][$post['ID']]['type'];
update_post_meta($post['ID'], '_type', $type);
} else {
delete_post_meta($post['ID'], '_type');
}
return $post;
}
function afields_to_edit($form_fields, $post){
$parentPost = get_post($post->post_parent);
/***********************************************************************
Roles
***********************************************************************/
$form_fields["roles"]["label"] = "File Role";
$form_fields["roles"]["input"] = "html";
$html .= "<select name="___attachments[".$post->ID."][type]" style="width:95%;">";
$html .= "<option value="">Default Role</option>";
$roles = apply_filters('roles_sidebar', array(), $post, $parentPost);
if (is_array($roles) && count($roles) > 0){
foreach($roles as $key=>$role){
$html .= "<option value="".$key."" ".$role['select'].">".$role['name']."</option>";
}
}
$html .= "</select>";
$form_fields["roles"]["html"] = $html;
return $form_fields;
}
I think you can continue work in this way…