Home › Forums › ACF PRO › Best Option for iFrame Embed › Reply To: Best Option for iFrame Embed
I know this is a few months old but I came across this while searching for how to escape an iframe and wanted to share my solution. I ended up using the url
field and then outputting the iframe in my custom template. I also added two additional text fields for width
and height
so my final code looked like this:
<?php echo ( '<iframe style="width:'. esc_attr( get_field( 'iframe_width' ) ) ."; height:" . esc_attr( get_field( 'iframe_height' ) ) . ';" src="' . esc_url( get_field( 'iframe_url' ) ) .'" frameborder="0" allowfullscreen></iframe>' ); ?>
Hope that helps!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.