
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.81 KB | hits: 15 | expires: Never
elseif ( $meta_box['type'] == "attachment" ) {
echo'<select name="'.$meta_box['name'].'_value">';
$outer_post = $post->ID;
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID // any parent
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $post) {
setup_postdata($post);
$option = $post->guid;
echo'<option value="';
if ( get_post_meta($outer_post, $meta_box['name'].'_value', true) == $option ) {
echo ' selected="selected"';
} elseif ( $option == $meta_box['std'] ) {
echo ' selected="selected"';
}
echo $option .'">'.$post->post_title.'</option>';
}
}
echo'</select>';
}