如何在Visual Composer’vc_map’中使用’custom_markup’参数?

我想知道是否有人对在Visual Composer中使用custom_markup参数有任何了解?我在此链接中遇到了一个解决方案, 但它似乎已经过时了。

我在用着:

  • WordPress 4.8
  • Visual Composer 5.1

任何帮助将不胜感激。谢谢。


#1


仅供参考, 你问题中提供的要点链接已更新, 并且他的解决方案与Wordpress 4.9.2和WPbakery Page Builder(以前为Visual Composer)5.4.5完美配合

js:

(function($) {
    window.VcCustomElementView = vc.shortcode_view.extend( {
        elementTemplate: false, $wrapper: false, changeShortcodeParams: function ( model ) {
            var params;

            window.VcCustomElementView.__super__.changeShortcodeParams.call( this, model );
            params = _.extend( {}, model.get( 'params' ) );
            if ( ! this.elementTemplate ) {
                this.elementTemplate = this.$el.find( '.vc_custom-element-container' ).html();
            }
            if ( ! this.$wrapper ) {
                this.$wrapper = this.$el.find( '.wpb_element_wrapper' );
            }
            if ( _.isObject( params ) ) {
                var template = vc.template( this.elementTemplate, vc.templateOptions.custom );
                this.$wrapper.find( '.vc_custom-element-container' ).html( template( { params: params } ) );
            }
        }
    } );
})(window.jQuery)

的PHP:

vc_map(array(
    'name' => __( 'Custom Markup', 'js_composer' ), 'base' => 'vc_custom_markup', 'category' => array(
        __( 'Content', 'js_composer' ), ), 'description' => __( 'Custom markup element', 'js_composer' ), 'params' => array(
        array(
            'type' => 'textfield', 'param_name' => 'style', 'value' => 'custom style!', 'heading' => 'Style', ), array(
          'type' => 'textfield', 'param_name' => 'color', 'value' => 'custom color!', 'heading' => 'Color', ), array(
          'type' => 'textfield', 'param_name' => 'title', 'value' => 'custom title!', 'heading' => 'Title', ), ), 'js_view' => 'VcCustomElementView', 'custom_markup' => '<div class="vc_custom-element-container">Style: "{{ params.style }}", Color: "{{ params.color }}", Title: "{{{ params.title }}}"</div>', )
);

所有学分归AngeIII所有

来源:

https://www.srcmini02.com/65481.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40916.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?