Inserir iframe num Post WordPress com shortcode

Adicione o seguinte código no seu arquivo functions.php

	function iframe_shortcode($atts, $content = null) {

		extract(shortcode_atts(array(
			'url'   => '',
			'scrolling'     => 'no',
			'width'     => '100%',
			'height'    => '500',
			'frameborder'   => '0',
			'marginheight'  => '0',
			'style'  => 'border:0',

		), $atts));

		if (empty($url)) return '';

		return '<iframe class="shortcode" src="'.$url.'" scrolling="'.$scrolling.'" width="'.$width.'" height="'.$height.'" style="'.$style.'" frameborder="'.$frameborder.'" marginheight="'.$marginheight.'">'.$content.'</iframe>';

	}

	add_shortcode('iframe','iframe_shortcode');

Para usar, basta seguir o exemplo abaixo e inserir no seu post:

[iframe url"http://leocaseiro.com.br/" width="500" height="300"]

Referência graphicbeacon.com

Deixe um Comentário

O seu endereço de email não será publicado Campos obrigatórios são marcados *

*

Você pode usar estas tags e atributos de HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>