admin管理员组文章数量:1122850
I want to allow code inside a textarea to write code with PHP, SQL or HTML...
What i want to do is create an element inside the Visual Composer where I can put some code to show it as i write it on my posts.
Here you can find the type values:
/
But no one of these works for me.
There is a proper way to do that?
array(
"type" => "textarea_html",
"heading" => esc_html__("Text", "js_composer"),
"param_name" => "text_code_snippet",
"admin_label" => true,
"description" => esc_html__("The text for your button." , "js_composer")
)
Thanks
I want to allow code inside a textarea to write code with PHP, SQL or HTML...
What i want to do is create an element inside the Visual Composer where I can put some code to show it as i write it on my posts.
Here you can find the type values:
https://kb.wpbakery.com/docs/inner-api/vc_map/
But no one of these works for me.
There is a proper way to do that?
array(
"type" => "textarea_html",
"heading" => esc_html__("Text", "js_composer"),
"param_name" => "text_code_snippet",
"admin_label" => true,
"description" => esc_html__("The text for your button." , "js_composer")
)
Thanks
Share Improve this question edited Sep 17, 2019 at 11:06 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Sep 17, 2019 at 10:46 Met El IdrissiMet El Idrissi 516 bronze badges1 Answer
Reset to default 0You can't write directly PHP or MySQL in a Visual Composer element. You can only write HTML and VC has a default element for that - "Raw HTML". If you would like to use PHP functionality, you can map it to a shortcode and then put the shortcode in a simple Text Block, or using 'vc_map', which you linked, you can create a new custom element and then in the 'base' parameter you can map it to a shortcode, you created.
vc_map( array(
'base' => 'svg_icon',
'name' => __( 'Svg Icon', 'ss' ),
'class' => '',
'icon' => 'icon-heart',
'params' => array(
array(
'type' => 'textfield',
'class' => '',
'heading' => __( 'Id', 'ss' ),
'param_name' => 'id',
'value' => 'fb',
),
),
) );
function sc_svg_icon($attr) {
$attr = shortcode_atts(array(
'id' => '',
),$attr);
ob_start(); ?>
<svg class="icon"><use xlink:href="#<?php echo $attr['id']; ?>" /></svg>
<?php return ob_get_clean();
}
add_shortcode('svg_icon','sc_svg_icon');
本文标签: pluginsHow to allow code like PHPSQLHTML to WPBakery Visual Composer
版权声明:本文标题:plugins - How to allow code like PHP, SQL, HTML to WPBakery Visual Composer? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736275400a1924313.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论