Created
June 23, 2016 22:45
-
-
Save tzkmx/dc28bd892231789f818115cf81bc0c26 to your computer and use it in GitHub Desktop.
Minimal shortcode to override WordPress virtual ban of iframes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function iframe_render_shortcode($atts) { | |
$keys = array_flip(array_keys($atts)); | |
$params = shortcode_atts($keys, $atts); | |
$out = []; | |
foreach($params as $key => $val) { | |
$out[] = $key . '="' . $val . '"'; | |
} | |
return '<iframe ' . implode(' ', $out) . '></iframe>'; | |
} | |
add_shortcode('iframe', 'iframe_render_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment