Manny Manny - 2 months ago 7
PHP Question

PHP add target="_blank

I hope everyone doing great, I need help how I can add target blank to a specific code

this is the code:

if( !empty($social_fb) ){
$result .= '<a href="'.esc_attr($social_fb).'"><i class="fa fa-facebook"></i></a>';
}


I try to add this:

if( !empty($social_fb) ){
$result .= '<a href=" target="_blank'.esc_attr($social_fb).'"><i class="tana-social tana-size-26 tana-facebook tana-circle fa fa-facebook"></i></a>';
}


but not work!

I hope someone can help me, many thanks in advances!
Regards
Manny

Answer

Try this

if( !empty($social_fb) ){
    $result .= '<a href="'.esc_attr($social_fb).'" target="_blank"><i class="tana-social tana-size-26 tana-facebook tana-circle fa fa-facebook"></i></a>';
}