![](https://cxg-design.jp/wp-content/uploads/2024/04/acfbanner02.png)
ACF EMBED
ACF oEmbedの表示コードです。ループ内に入れます。add_embedがフィールド名です。
YouTubeなどの埋め込みができます。レスポンシブ対応にするためには、embde-containerタグで囲み、CSSの設定も必要。
<?php the_field('add_embed'); ?>
<style>
.embed-container {
position: relative;
padding-bottom: 56.25%;
overflow: hidden;
max-width: 100%;
height: auto;
}
.embed-container iframe,
.embed-container object,
.embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>