wordpress - How to create shortcode for custom progress bar addon in visual composer? -
there built-in addon named progress bar in visual composer. want create custom progress bar of own style.
my custom progress bar addon code:
<?php // 2 addons vc_map( array( 'name' => __( 'about & progress bar', 'f_triangle' ), 'base' => 'abt_us_progress_bar', "category" => __( "f triangle", "f_triangle"), 'description' => __( '', 'f_triangle' ), 'params' => array( array( 'type' => 'param_group', 'heading' => __( 'values', 'f_triangle' ), 'param_name' => 'values', 'description' => __( 'enter values graph - value, title , color.', 'f_triangle' ), 'group' => __( 'progress bar', 'f_triangle' ), 'value' => urlencode( json_encode( array( array( 'label' => __( 'design', 'f_triangle' ), 'value' => '35', ), array( 'label' => __( 'html', 'f_triangle' ), 'value' => '80', ), array( 'label' => __( 'php', 'f_triangle' ), 'value' => '60', ), ) ) ), 'params' => array( array( 'type' => 'textfield', 'heading' => __( 'label', 'f_triangle' ), 'param_name' => 'label', 'description' => __( 'enter text used title of bar.', 'f_triangle' ), 'admin_label' => true, ), array( 'type' => 'textfield', 'heading' => __( 'value', 'f_triangle' ), 'param_name' => 'value', 'description' => __( 'enter value of bar.', 'f_triangle' ), 'admin_label' => true, ), ), ), ) ) ); ?>
my html code:
<div class="col-sm-5 wow fadeinright" data-wow-duration="1000ms" data-wow-delay="300ms"> <div class="our-skills"> <h2 class="bold">our skills</h2> <div class="single-skill"> <h3>design</h3> <div class="progress"> <div class="progress-bar progress-bar-primary six-sec-ease-in-out" role="progressbar" data-transition="35">35%</div> </div> </div> <div class="single-skill"> <h3>html</h3> <div class="progress"> <div class="progress-bar progress-bar-primary six-sec-ease-in-out" role="progressbar" data-transition="80">80%</div> </div> </div> <div class="single-skill"> <h3>php</h3> <div class="progress"> <div class="progress-bar progress-bar-primary six-sec-ease-in-out" role="progressbar" data-transition="60">60%</div> </div> </div> </div> </div>
my custom progress bar addon working fine in wordpress backend editor can't understand how can create shortcode addon integrate html. that's why unable make visible in frontend. so, how can create shortcode addon?
you must add shortcode function using add_shortcode hook in functions https://codex.wordpress.org/function_reference/add_shortcode
and in vc map parameters add shortcode in base parameter add shortcode attributes in params array https://wpbakery.atlassian.net/wiki/spaces/vc/pages/524332/vc+map
for example have own shortcode bartag foo attribute
// [bartag foo="foo-value"] add_shortcode( 'bartag', 'bartag_func' ); function bartag_func( $atts ) { extract( shortcode_atts( array( 'foo' => 'something' ), $atts ) ); return "foo = {$foo}"; } vc_map( array( "name" => __( "bar tag test", "my-text-domain" ), "base" => "bartag", "class" => "", "category" => __( "content", "my-text-domain"), 'admin_enqueue_js' => array(get_template_directory_uri().'/vc_extend/bartag.js'), 'admin_enqueue_css' => array(get_template_directory_uri().'/vc_extend/bartag.css'), "params" => array( array( "type" => "textfield", "holder" => "div", "class" => "", "heading" => __( "text", "my-text-domain" ), "param_name" => "foo", "value" => __( "default param value", "my-text-domain" ), "description" => __( "description foo param.", "my-text-domain" ) ) ) ) );
Comments
Post a Comment