'',
'animation_type' => 'rotate-1',
'animation_texts' => '',
), $atts )
);
// add letters class in $animation_type variable.
switch ($animation_type) {
case 'rotate-2':
case 'rotate-3':
case 'type':
case 'scale':
$animation_type .= " letters";
}
$html = ' '. $title .' ';
$html .= '';
$html .= apply_filters( 'ahvc_animation_texts', $animation_texts );
$html .= '
';
return $html;
}
/*************************************************************************
Some Shortcode Related Filters
*************************************************************************/
add_filter( 'ahvc_animation_texts', 'ahvc_prepare_animated_texts' );
function ahvc_prepare_animated_texts( $animation_texts ){
// First convert ',' separeted texts into array
$animation_texts = explode(',', $animation_texts);
// Second is-visible class to the first element
$html .= '';
for( $x = 0; $x < count( $animation_texts ); $x++ ) {
$addclass = ( $x == 0 ) ? "is-visible" : "";
$html .= ''.$animation_texts[$x].''."\n";
}
return $html;
}
/*************************************************************************
Add the shortcode to WPBakery Visual Composer Builder
*************************************************************************/
add_action( 'vc_before_init', 'ahvc_animated_headline_vc_shortcode' );
function ahvc_animated_headline_vc_shortcode(){
vc_add_shortcode_param( 'raw_html', 'ahvc_add_custom_param_type' );
vc_map( array(
"name" => __( "Animated Headline", "ahvc" ),
"base" => "animated_headline_vc",
'description' => '10+ animation texts effects',
"class" => "animated_headline_vc",
"icon" => plugins_url('/assets/admin/images/animation.svg', __FILE__),
"category" => __( "Content", "ahvc"),
'front_enqueue_js' => array( plugins_url( '/assets/admin/js/jquery.tagsinput-revisited.js', __FILE__ ), plugins_url( '/assets/admin/js/animated_heading_vc.js', __FILE__ ), plugins_url( '/assets/admin/js/script.js', __FILE__ )),
'front_enqueue_css' => array( plugins_url( '/assets/admin/css/jquery.tagsinput-revisited.css', __FILE__ ),plugins_url( '/assets/admin/css/heading_animations.css', __FILE__ ), plugins_url( '/assets/admin/css/style.css', __FILE__ )),
'admin_enqueue_js' => array( plugins_url( '/assets/admin/js/jquery.tagsinput-revisited.js', __FILE__ ), plugins_url( '/assets/admin/js/animated_heading_vc.js', __FILE__ ), plugins_url( '/assets/admin/js/script.js', __FILE__ )),
'admin_enqueue_css' => array( plugins_url( '/assets/admin/css/jquery.tagsinput-revisited.css', __FILE__ ), plugins_url( '/assets/admin/css/heading_animations.css', __FILE__ ), plugins_url( '/assets/admin/css/style.css', __FILE__ )),
"params" => array(
array(
"type" => "textfield",
"holder" => "div",
"class" => "animation_texts_title",
"heading" => __( "Title", "ahvc" ),
"param_name" => "title",
"value" => __( "", "ahvc" ),
"description" => __( "Enter title (Goes Before Animated Texts)", "ahvc" )
),
array(
"type" => "textfield",
"holder" => "div",
"class" => "animation_texts_options",
"heading" => __( "Animated Texts", "ahvc" ),
"param_name" => "animation_texts",
"value" => __( "", "ahvc" ),
"description" => __( "Enter Texts You Want to Animate", "ahvc" )
),
array(
"type" => "dropdown",
"holder" => "div",
"class" => "animation_type",
"heading" => __( "Animation Type", "ahvc" ),
"param_name" => "animation_type",
'value' => array(
'Choose Type' => '',
'Rotate 1' => 'rotate-1',
'Rotate 2' => 'rotate-2',
'Rotate 3' => 'rotate-3',
'Type' => 'type',
'Loading Bar' => 'loading-bar',
'Slide' => 'slide',
'Clip' => 'clip',
'Zoom' => 'zoom',
'Scale' => 'scale',
'Push' => 'push',
),
"description" => __( "Select Animation Type", "ahvc" )
),
array(
"type" => "raw_html",
"holder" => "div",
"class" => "animation_preview",
"heading" => __( "Animation Preview", "ahvc" ),
"param_name" => "animation_preview",
"value" => __( "", "ahvc" ),
"description" => __( "Choose Different Animation Type to Preview it here", "ahvc" )
),
array(
"type" => "raw_html",
"holder" => "div",
"class" => "animation_preview",
"heading" => __( "Animation Preview", "ahvc" ),
"param_name" => "animation_preview",
"value" => __( "", "ahvc" ),
"description" => __( "Choose Different Animation Type to Preview it here", "ahvc" )
),
)
));
}
/*************************************************************************
Adding Custom vc_map Fields
*************************************************************************/
function ahvc_add_custom_param_type( $settings, $value ) {
return '';
}
?>