我正在尝试创建一个元盒来上载多个文件(可以是图像或文件)。
目前,我有上传字段和它的工作良好,直到我们按下上传并保存数据。
唯一的问题是显示文件。
下面是我的代码,我正在使用它来显示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)当前它会显示所有附加到post&;的文件;我只需要显示使用此元盒上载的文件。
2) 需要文件的小缩略图预览。
当做