Think this is what your trying to do what id suggest doing is leaving window blank and just doing an if statement on that
How you want it
function sc_link( $atts ) { extract( shortcode_atts( array( 'page' => '', 'style' => 'button', 'window' => 'self', 'label' => 'Missing Label Tag: label=""', ), $atts ) ); if($window == "new"){ $link = '<a href="' . $page . '" class="' . $style. '" target="_blank">' . $label . '</a>'; }else{ $link = '<a href="' . $page . '" class="' . $style. '" target="_self">' . $label . '</a>'; } return $link; } add_shortcode( 'mylink', 'sc_link' );
How it should be
function sc_link( $atts ) { extract( shortcode_atts( array( 'page' => '', 'style' => 'button', 'window' => '', 'label' => 'Missing Label Tag: label=""', ), $atts ) ); if(!$window){ $link = '<a href="' . $page . '" class="' . $style. '" target="_self">' . $label . '</a>'; }else{ $link = '<a href="' . $page . '" class="' . $style. '" target="' . $window . '">' . $label . '</a>'; } return $link; } add_shortcode( 'mylink', 'sc_link' ); The your shortcode will be link [shorcode page="" window="" label=""]