问题是image
不是正确的mime类型。您可以看到list of mime-types here - 因此,根据链表,我们需要传递所需内容的数组:
$supported_mimes = array(
\'image/jpeg\', \'image/gif\', \'image/png\',
\'video/avi\', \'video/x-flv\', \'video/mp4\', \'video/ogg\', \'video/webm\',
);
$args = array(
\'numberposts\' => -1, // Using -1 loads all posts
\'orderby\' => \'menu_order\', // This ensures images are in the order set in the page media manager
\'order\' => \'ASC\',
\'post_mime_type\' => $supported_mimes
\'post_parent\' => $post->ID, // Important part - ensures the associated images are loaded
\'post_status\' => null,
\'post_type\' => \'attachment\'
);
我认为更大的问题是让WordPress允许您创建一个包含图像和视频的图库,但就目前而言,这只是将媒体上传到该帖子。