如何使用 ACF 在自定义页面上显示所有嵌入字段

How to display all oembed fields on custom page with ACF

我应该创建一个页面,您可以在其中查看特定自定义 post 类型的所有视频(嵌入字段)。

示例: 自定义 Post 类型 = 项目

Project 中有 4 篇文章,每篇文章中上传了 4 个视频。

所以我的问题是:如何构建我的功能,以便它允许我提取所有文章的视频并在一个页面中显示它们?

尝试此代码,但更改自定义视频字段的键

$args = [  
    'post_type' => 'project', // your custom post type
    'post_status' => 'publish', 
];

$loop = new WP_Query( $args ); 
    
while ( $loop->have_posts() ) { $loop->the_post(); 
    $video = get_field('video', get_the_ID()); // check custom field key
    print $video;  
}

wp_reset_postdata();