vc_map: невозможно использовать шорткоды внутри блока textarea_html

Я разработал пользовательский элемент Visual Composer, используя vc_map (), который имеет простой заголовок, содержимое WISYWIG и фоновое изображение. Моя проблема в том, что любой шорткод, который я использую внутри блока контента, не обнаруживается и либо выдается в виде необработанного шорткода, либо, если я звоню через do_shortcode, закомментируется при сохранении.

// Element Class
class vcInfoBox extends WPBakeryShortCode {

// Element Init
function __construct() {
//  add_action( 'init', array( $this, 'vc_infobox_mapping' ) );
$this->vc_infobox_mapping();
}

// Element Mapping
public function vc_infobox_mapping() {

// Stop all if VC is not enabled
if ( !defined( 'WPB_VC_VERSION' ) ) {
return;
}

// Map the block with vc_map()
vc_map(
array(
'name' => __('VC Infobox', 'text-domain'),
'base' => 'vc_infobox',
'description' => __('A simple callout box with backing image', 'text-domain'),
'category' => __('Custom Elements', 'text-domain'),
'icon' => get_template_directory_uri().'/assets/img/vc-icon.png',
'params' => array(

array(
'type' => 'textfield',
'holder' => 'h2',
'class' => 'title-class',
'heading' => __( 'Title', 'text-domain' ),
'param_name' => 'title',
// 'value' => __( 'Default value', 'text-domain' ),
'description' => __( 'Box Title', 'text-domain' ),
'admin_label' => false,
'weight' => 0,
'group' => 'Custom Group',
),

array(
'type' => 'textarea_html',
'holder' => 'div',
// 'class' => 'text-class',
'heading' => __( 'Content', 'text-domain' ),
'param_name' => 'content',
'value' => __( '', 'text-domain' ),
'description' => __( 'Main content inside block', 'text-domain' ),
// 'admin_label' => false,
// 'weight' => 0,
'group' => 'Custom Group',
),

array(
'type' => 'attach_image',
'holder' => 'img',
//'class' => 'text-class',
'heading' => __( 'Background Image', 'text-domain' ),
'param_name' => 'bgimg',
// 'value' => __( 'Default value', 'text-domain' ),
'description' => __( 'Image to be displayed behind callout block', 'text-domain' ),
'admin_label' => false,
'weight' => 0,
'group' => 'Custom Group',
),

array(
'type' => 'dropdown',
'class' => '',
'heading' => __( 'Alignment', 'text-domain' ),
'param_name' => 'align',
'value' => array(
'Left' => "align-left",
'Right' => "align-right",
),
'description' => __( 'Left or right alignment for callout block?', 'text-domain' ),
'admin_label' => false,
'weight' => 0,
'group' => 'Custom Group',
),

),
)
);

}// Element HTML
public function vc_infobox_html( $atts, $content ) {

// Params extraction
extract(
shortcode_atts(
array(
'title' => '',
'bgimg' => 'bgimg',
'align' => '',
),
$atts
)
);

$img_url = wp_get_attachment_image_src( $bgimg, "large");
// die ( print_r($align, true) );

// Fill $html var with data
$html = '
<div class="info-callout '. $align .'" style="background-image:url('. $img_url[0] .');">
<div class="info-callout--content-wrap">
<h2 class="info-callout--title">'. $title .'</h2>
<div class="info-callout--content">'. $content .'</div>
</div>
</div>';

return $html;

}

} // End Element Class

И в functions.php:

require_once( get_stylesheet_directory().'/vc-elements/custom-callout-block.php' );

add_action( 'vc_before_init', 'vc_before_init_actions' );

function vc_before_init_actions() {

$InfoBox = new vcInfoBox();
add_shortcode( 'vc_infobox', array( $InfoBox, 'vc_infobox_html' ) );

}

Я сравнил свой массив с элементом Text Text по умолчанию в VC, они, кажется, совпадают … Кто-нибудь знает, что мне не хватает?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector