Simple iframe Shortcode Plugin
Posted September 21, 2011
I was unable to find anything that made it easy to paste iframe embed codes into the visual editor. The existing solutions all required me to transpose info from the embed code to the shortcode. This allows you to simply paste your iframe code. Just put it inside [iframe][/iframe].
Update: Now available in repository as plugin ready to go
http://wordpress.org/extend/plugins/iframe-shortcode/
add_shortcode( 'iframe', 'simple_iframe_sc' ); function simple_iframe_sc( $atts, $content = null ) { $char = array( '‘', '’', '“', '”', '′', '″' ); $replace = array( "'", "'", '"', '"', "'", '"' ); return html_entity_decode( str_replace( $char, $replace, $content ) ); }
Example use:
[iframe]<iframe width="560" height="315" src="http://www.youtube.com/embed/KuxWu1D3Mk4" frameborder="0" allowfullscreen></iframe>[/iframe]
Stay Up to Date
Subscribe to our spam free newsletter for all our latest updates and resources delivered to your inbox. Unsubscribe anytime.