| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Heading
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("Button", 'taskereasy'),
- "base" => "taskereasy_button",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy button", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "vc_link",
- "heading" => esc_html__("URL", 'taskereasy'),
- "param_name" => "btn_link",
- "value" => ''
- ),
- array(
- 'type' => 'dropdown',
- 'heading' => esc_html__( 'Button Style', 'taskereasy' ),
- 'param_name' => 'btn_style',
- 'value' => array('Style 1' => 'style1', 'Style 2' => 'style2')
- ),
- array(
- 'type' => 'dropdown',
- 'heading' => esc_html__( 'Button Alignment', 'taskereasy' ),
- 'param_name' => 'btn_align',
- 'value' => array('Left' => 'text-left', 'Center' => 'text-center', 'Right' => 'text-right')
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- )
- )
- ));
- add_shortcode( 'taskereasy_button', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'btn_link' => '',
- 'btn_style' => 'style1',
- 'btn_align' => 'text-left',
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $btnlink = vc_build_link( $btn_link );
- $btn_link = !empty($btnlink['url']) ? $btnlink['url'] : '#';
- $btn_title = $btnlink['title'];
- $btn_target = !empty($btnlink['target']) ? $btnlink['target'] : '_self';
- $output = '';
- $output .='
- <div class="'.esc_attr($custom_design).' vc-button '.esc_attr($btn_align).'">';
- if(html_entity_decode(vc_value_from_safe($btn_style, true)) == 'style1'){
- $output .= '<a href="'.esc_url($btn_link).'" class="btn" target="'.esc_attr($btn_target).'">'.esc_html($btn_title).' <i class="fa fa-angle-right"></i></a>';
- }
- if(html_entity_decode(vc_value_from_safe($btn_style, true)) == 'style2'){
- $output .= '<a href="'.esc_url($btn_link).'" class="btn btn-secondary" target="'.esc_attr($btn_target).'" >'.esc_html($btn_title).' <i class="fa fa-angle-right"></i></a>';
- }
- $output .=' </div>';
- return $output;
- });
|