Now I can order de post_types. Any help for the multiple save?
// The Callback
function show_custom_meta_box_related() {
global $custom_meta_fields_related, $post;
// Use nonce for verification
echo ”;
// Begin the field table and loop
echo '<table class="form-table">';
foreach ($custom_meta_fields_related as $field_related) {
// get value of this field if it exists for this post
$meta_related = get_post_meta($post->ID, $field_related['id'], true);
// begin a table row with
echo '<tr>
<th><label for="'.$field_related['id'].'">'.$field_related['label'].'</label></th>
<td>';
switch($field_related['type']) {
// case items will go here
// post_list
case 'post_list':
echo '<select multiple style="height:200px; width:300px" name="'.$field_related['id'].'" id="'.$field_related['id'].'">';
echo '<option value=""></option>'; // Select One
foreach($field_related['post_type'] as $tipo_post){
$items = get_posts( array (
'post_type' => $tipo_post,
'posts_per_page' => -1
));
foreach($items as $item) {
echo '<option value="'.$item->ID.'"',$meta_related == $item->ID ? ' selected="selected"' : '','> '.$item->post_title. '</option>';
} // end foreach
}
echo '</select><br /><span class="description">'.$field_related['desc'].'</span>';
break;
} //end switch
echo '</td></tr>';
} // end foreach
echo '</table>'; // end table
}