Okay
  Public Ticket #336409
Trying to open Team Member Image URL in new tab
Closed

Comments

  • Spencer started the conversation

    Trying to open the team member images in a new tab with target="_blank"

    Here is my code from Salient/nectar/tinymce/shortcode-processing.php:

    //Team Member

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

    extract(shortcode_atts(array("description" => '', 'team_memeber_style' => '', 'color' => 'Accent-Color', 'name' => 'Name', 'job_position' => 'Job Position', 'image_url' => '', 'social' => '', 'link_element' => 'none', 'link_url' => '', 'link_url_2' => ''), $atts));

    $html = null;

    $html .= '<div data-style="'.$team_memeber_style.'">';

    if($team_memeber_style == 'meta_overlaid'){

    $html .= '<div></div>';

    if(!empty($image_url)){

    if(preg_match('/^\d+$/',$image_url)){

    $image_src = wp_get_attachment_image_src($image_url, 'portfolio-thumb');

    $image_url = $image_src[0];

    }

    //image link

    if(!empty($link_url_2)){

    $html .= '<a href="'.$link_url_2.'" target="_blank" ></a> <div style="background-image: url('.$image_url.');"></div>';

    } else {

    $html .= '<div style="background-image: url('.$image_url.');"></div>';

    }

    }

    else {

    //image link

    if(!empty($link_url_2)){

    $html .= '<a href="'.$link_url_2.'" target="_blank"></a><div style="background-image: url('. NECTAR_FRAMEWORK_DIRECTORY . 'assets/img/team-member-default.jpg);"></div>';

    } else {

    $html .= '<div style="background-image: url('. NECTAR_FRAMEWORK_DIRECTORY . 'assets/img/team-member-default.jpg);"></div>';

    }

    }

    //name link

    $html .= '<div>';

    $html .= '<h3>' . $name . '</h3>';

    $html .= '<p>' . $job_position . '<p>';

    $html .= '</div>';

    } else {

    if(!empty($image_url)){

    if(preg_match('/^\d+$/',$image_url)){

    $image_src = wp_get_attachment_image_src($image_url, 'full');

    $image_url = $image_src[0];

    }

    //image link

    if($link_element == 'image' || $link_element == 'both'){

    $html .= '<a href="'.$link_url.'" target="_blank"><img alt="'.$name.'" src="' . $image_url .'" title="' . $name . '" /></a>';

    } else {

    $html .= '<img alt="'.$name.'" src="' . $image_url .'" title="' . $name . '" />';

    }

    }

    else {

    //image link

    if($link_element == 'image' || $link_element == 'both'){

    $html .= '<a href="'.$link_url.'" target="_blank"><img alt="'.$name.'" src="' . NECTAR_FRAMEWORK_DIRECTORY . 'assets/img/team-member-default.jpg" title="' . $name . '" /></a>';

    } else {

    $html .= '<img alt="'.$name.'" src="' . NECTAR_FRAMEWORK_DIRECTORY . 'assets/img/team-member-default.jpg" title="' . $name . '" />';

    }

    }

    //name link

    if($link_element == 'name' || $link_element == 'both'){

    $html .= '<h4><a href="'.$link_url.'">' . $name . '</a></h4>';

    } else {

    $html .= '<h4>' . $name . '</h4>';

    }

    $html .= '<div>' . $job_position . '</div>';

    $html .= '<p>' . $description . '</p>';

    if (!empty($social)) {

    $social_arr = explode(",", $social);

    $html .= '<ul>';

    for ($i = 0 ; $i < count($social_arr) ; $i = $i + 2) {

    $target = null;

    $url_host = parse_url($social_arr[$i + 1], PHP_URL_HOST);

    $base_url_host = parse_url(get_template_directory_uri(), PHP_URL_HOST);

    if($url_host != $base_url_host || empty($url_host)) {

    $target = 'target="_blank"';

    }

    $html .= "<li><a ".$target." href='" . $social_arr[$i + 1] . "'>" . $social_arr[$i] . "</a></li>";

    }

    $html .= '</ul>';

    }

    }

    $html .= '</div>';

    return str_replace("\r\n", '', $html);

    }

    add_shortcode('team_member', 'nectar_team_member');

  •  8,454
    Tahir replied

    Hey!

    It seems you have added the target="_blank " . Can you provide the page url so we can see whats the issue. 

    Thanks 


    ThemeNectar Support Team 

  • Spencer replied

    Thank you for getting back!

    http://www.fennecbrand.com/

  •  8,454
    Tahir replied

    Hey Again!

    Could you allow us to log in so we can check on this for you more?. 
    Thanks


    ThemeNectar Support Team