I am modifying a wordpress theme. I want to be able to give the option to have a link open in a new tab using shortcode.
// add shortcode for About Our Charity Section
function theme_about_charity($atts, $content = null){
extract(shortcode_atts(array(
'title' => '',
'icon' => '',
'link' => '',
'last' => '',
'newTab' => ''
),$atts));
return ' <div class="about-box" id="'.(($last == 'yes') ? 'last' : '').'">
<h3><i class="fa fa- '.$icon.'"></i><a href="'.$link.'" target="'.($newTab == 'yes')? '_blank' : '_self' . '">' .$title.'</a></h3>
<p>'.$content.'</p>
</div>';
}
add_shortcode('about_charity','theme_about_charity');
when the user creates the shortcode:
[about_charity icon="icon" title="title" link="#" newTab="yes" ]lorem ipsum[/about_charity]
Right now the code is just printing, "_blank" onto my web page.
The code works for modifying the id attribute of the div but not the target attribute of the link. Can someone explain this and offer a suggestion for how to make this work? Thanks!