0
votes

How would I create a shortcode such that when a URL is pasted in a Wordpress blog post in Visual mode it get parsed and converted to an iFrame?

Here's an example: http://en.support.wordpress.com/shortcodes/getty-images/

That guide illustrates that the user can paste a URL to a GettyImage in the Visual mode and it gets converted to an iFrame.

1
You're probably going to need to look into creating a plugin for TinyMCE. - vvanasten

1 Answers

0
votes

You can create a shortcode just by editing your functions.php of your wordpress theme:

function convert_to_iframe_shortcode( $atts ) {
  extract( shortcode_atts( array(
    'url'    => 'http://standarsite.com'
  ), $atts ) );

   return
    '<iframe src="'.$url.'"></iframe>';
}
add_shortcode( 'iframeurl', 'convert_to_iframe_shortcode' );

Then in your blog post, you can use shortcodes like this

[iframeurl url="http://yoursite.com"]