PHP shortcode button

Hi there, I’m trying to get my shortcode button to open in a new window, the php for the button is below:

[php]function si_button( $atts, $content = null ) {

extract(shortcode_atts(array(
	'url' => '#',
	'new' => '#'
), $atts));

if ($new == "yes") {

	$targ = " target='_blank'";

} else {
	
	$targ = "";

}

return ‘<a href="’.$url.’" class=“btn”’.$targ.’>’ . do_shortcode($content) . ‘’;

}
add_shortcode( ‘button’, ‘si_button’ );[/php]

I’ve inserted:

[button url=http://envato.com/ target="_blank" ]Buy Now[/button]

in the iframe but its still not opening in a different window.
Can someone please help???
Thanks!

That button doesn’t have anything to do with the code you’ve given us. But i think you’re missing up with the target bit, once it gets inserted into the html string, it looks like it’ll have like quotes.

If you can show us what the results of this is, it will help a lot.

[php] return ‘<a href="’.$url.’" class=“btn”’.$targ.’>’ . do_shortcode($content) . ‘’;
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service