问题描述
我创建了一个自定义的可视化作曲家容器元素来将所有类型的元素作为子元素保存。这部分元素有效,因为我可以将任何元素添加为子元素(稍后我将创建实际的子元素)。但是,当我将一个子元素添加到我的自定义容器,然后复制该子元素时,整个自定义容器元素都会被复制(有关视觉展示,请参见图像)。该错误发生在所有元素上,也是标准的内置电子
我的元素代码:
if ( ! defined( 'ABSPATH' ) ) {
die ('Silly human what are you doing here');
}
if ( ! class_exists( 'apFeatureListCard' ) ) {
class apFeatureListCard {
/**
* Main constructor
*
*/
public function __construct() {
// Registers the shortcode in wordpress
add_shortcode( 'feature-list-container',array( 'apFeatureListCard','renderFeatureParent' ) );
// Map shortcode to Visual Composer
if ( function_exists( 'vc_map' ) ) {
vc_map(apFeatureListCard::mapFeatureParent());
}
}
/**
* Map shortcode to VC
*
* This is an array of all your settings which become the shortcode attributes ($atts)
* for the output.
*
*/
public static function mapFeatureParent() {
return array(
'name' => esc_html__( 'Feature Carousel','text-domain' ),'description' => esc_html__( 'display a feature list in a carousel','base' => 'apFeatureListCard','content_element' => true,'category' => __('NIGHTLY Elements','text-domain'),'icon' => 'ap-icon-card-img','is_container' => true,'params' => array(
array(
'type' => 'attach_image','holder' => 'img','heading' => __( 'Image','param_name' => 'ap_card_icon_img',// 'value' => __( 'Default value','admin_label' => false,'weight' => 0,'group' => 'Card details',),);
}
/**
* Shortcode featuer container list
*
*/
public static function renderFeatureParent( $atts,$content = null ) {
return '<div class="feature-list-container">'.do_shortcode($content).'</div>';
}
}
}
new apFeatureListCard;
if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
class WPBakeryShortCode_apFeatureListCard extends WPBakeryShortCodesContainer {
}
}
这是我的自定义容器元素,它包含一个分隔符作为子元素。此时一切正常。
然后,如果我去复制我创建的自定义元素内部的分隔线,整个自定义元素容器都会被复制,它的元素也在里面。看这里的图片:
预期的结果是它应该只复制子元素本身,而不是父元素及其所有嵌套元素。提前感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)