WP Custom Address shortcode element development with visual composer
//==============Address shortcode make.=============
html code:
..............
<div class="icon-box-small"><i class="icon-map"></i>
<hr>
<h4>Address</h4>
<p><span>Fourth Floor</span><span>76 Ninth Ave, New York</span></p>
</div>
................................................
//iconpicker use korle font-awesome theke icon asbe. but textfield use kora hoyse commet theme er icon use korar jonno.
visual composer e giye icon er nam dite hobe tahole commet theme er icon pabe.
<?php
function commet_contact_box($one, $two){
$commet = shortcode_atts([
'title' =>' ',
'desc' =>' ',
'icon' =>' '
], $one);
ob_start();
?>
<div class="icon-box-small"><i class="<?php echo $commet['icon']; ?>"></i>
<hr>
<h4><?php echo $commet['title']; ?></h4>
<p><?php echo $commet['desc']; ?></p>
</div>
<?php
return ob_get_clean();
}
add_shortcode('commet_contact_box', 'commet_contact_box'); //first er ta shortcode, r second value amader create kora function er name.
vc_map([
'name' =>'Commet Contact Box',
'base' =>'commet_contact_box',
'icon' =>get_template_directory_uri(). '/images/cat.png',
'description' =>'Commet Custom box',
'params' =>[
[
'param_name' => 'title',
'type' =>'textfield',
'heading' =>'Title'
],
[
'param_name' => 'desc',
'type' =>'textarea',
'heading' =>'Description'
],
[
'param_name' => 'Icon',
'type' =>'textfield',
'heading' =>'icon'
]
]
]);
?>
........................
No comments