не работает vc_link и изображение в wpbakery - PullRequest
0 голосов
/ 17 апреля 2020

Я пытаюсь создать пользовательский элемент в конструкторе wpbakery, в который я добавляю изображение и URL. Все работает нормально, есть только одна проблема в URL и изображении. Может кто-нибудь, пожалуйста, помогите мне решить эту проблему. Ниже приведен код, который я пытаюсь

if ( ! function_exists( 'bt_logos_slider_child' ) ) {
function bt_logos_slider_child( $atts, $content = null ) {
    $output = $brand_image = $imagesize = $isresize = $tooltip = $logosliderlink =  "";
    $atts = shortcode_atts(
        array(
            "tooltip"           => '',
            "brand_image"       => '',
            "imagesize"         => "",
            "isresize"          => "no",
            "logosliderlink"    => '',
        ), $atts
    );

    $content = wpb_js_remove_wpautop($content);

    $img = $thumbnail = "";

    $fullimage = wp_get_attachment_image_src($brand_image, 'full');
    $thumbnail = $fullimage[0];
    if($isresize=="yes"&&$imagesize!=""){
        if(function_exists('wpb_resize')){
            $img = wpb_resize($brand_image, null, $imagesize, null);
            $thumbnail = $img['url'];
            if($thumbnail=="") $thumbnail = $fullimage[0];
        }
    }

    $image_str = '';

    $logosliderlink = vc_build_link($logosliderlink);
    $output = '';

    $output = '<div class="slide">';
        $output .= '<div class="logoslider-wrapper">';

            if($logosliderlink["url"]!=""){
                $image_str .= '<a href="'.$logosliderlink["url"].'" title="'.$logosliderlink["title"].'" target="'.$logosliderlink["target"].'" rel="'.$logosliderlink["rel"].'" class="cq-cardslider-imagelink">';
            }
                if($thumbnail != "") $image_str .= '<img src="'.$thumbnail.'" class="cq-cardslider-img" title="'.$tooltip.'" alt="">';

            if($logosliderlink["url"]!="") $image_str .= '</a>';

            $output .= $image_str;



        $output .= '</div>';
    $output .= '</div>';
    return $output;
}

add_shortcode( 'bt_logobrands_slider_child', 'bt_logos_slider_child' );
}

FrontEnd не отображать URL ссылки / href Результат ScreenShot

...