0
我想創建一個metabox上傳多個文件(可以是圖像或文件)。在Wordpress中創建多個文件Metabox
目前我有上傳字段及其工作文件,直到我們按上傳和保存數據。
唯一的問題是顯示文件。
下面是我的代碼,我使用的顯示metabox:
case 'file_list':
echo '<input class="cmb_upload_file" type="text" size="36" name="', $field['id'], '" value="" />';
echo '<input class="cmb_upload_button button" type="button" value="Upload File" />';
echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
echo '<ul class="attach_list">';
foreach ($attachments as $attachment) {
echo '<li>'.wp_get_attachment_link($attachment->ID, 'thumbnail', 0, 0, 'Download');
echo '<span>';
echo apply_filters('the_title', ' '.$attachment->post_title);
echo '</span></li>';
}
echo '</ul>';
}
break;
1)目前,它的顯示我,我需要只顯示使用該metabox上傳的文件附後&所有文件。
2)需要文件的小縮略圖預覽。
問候。
可以請你分享一些示例代碼.. –