plugins – How to allow PHP, SQL, HTML-like code to WPBakery Visual Composer?

You cannot write PHP or MySQL directly in Visual Composer Elementor. You can just write HTML and VC has a default element for that – “Raw HTML”. If you want to use the PHP functionality, you can map it to a shortcode and then put the shortcode into a simple text block, or using ‘vc_map’, which you linked, you can create a new You can create custom element and then in ‘Base’ parameter you can map it to the shortcode you created.

vc_map( array(
'base' => 'svg_icon',
'name' => __( 'Svg Icon', 'ss' ),
'class' => '',
'icon' => 'icon-heart',
'params' => array(
        'type' => 'textfield',
        'class' => '',
        'heading' => __( 'Id', 'ss' ),
        'param_name' => 'id',
        'value' => 'fb',
) );

function sc_svg_icon($attr) {
$attr = shortcode_atts(array(
  'id' => '',

ob_start(); ?>
  <svg class="icon"><use xlink:href="#<?php echo $attr['id']; ?>" /></svg>
  <?php return ob_get_clean();

Leave a Comment