vc-cta.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Testimonials
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html__("Call to Action", 'taskereasy'),
  7. "base" => "taskereasy_cta",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html__("Add taskereasy CTA", 'taskereasy'),
  11. "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. "type" => "textfield",
  15. "heading" => esc_html__("Title", 'taskereasy'),
  16. "param_name" => "title",
  17. ),
  18. array(
  19. "type" => "checkbox",
  20. "heading" => esc_html__("Add Link", 'taskereasy'),
  21. "param_name" => "show_link",
  22. ),
  23. array(
  24. 'type' => 'vc_link',
  25. 'heading' => esc_html__( 'Link', 'taskereasy' ),
  26. 'param_name' => 'btn_link',
  27. "dependency" => array(
  28. "element" => "show_link",
  29. "value" => "true"
  30. )
  31. ),
  32. /***************************design option tab*******************/
  33. array(
  34. 'type' => 'css_editor',
  35. 'heading' => esc_html__( 'CSS', 'taskereasy' ),
  36. 'param_name' => 'custom_design',
  37. 'group' => esc_html__( 'Design options', 'taskereasy' ),
  38. )
  39. )
  40. ));
  41. add_shortcode( 'taskereasy_cta', function($atts, $content = null) {
  42. extract(shortcode_atts(array(
  43. 'title' => '',
  44. 'btn_link' => '',
  45. 'custom_design' => '',
  46. ), $atts));
  47. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  48. $output = '';
  49. $title_text = html_entity_decode(vc_value_from_safe($title, true));
  50. $btnlink = vc_build_link( $btn_link );
  51. $btn_link = $btnlink['url'];
  52. $btn_title = $btnlink['title'];
  53. $btn_target = $btnlink['target'];
  54. $output .=
  55. '<section class="banner4-wrapper-inner '.$custom_design.'">
  56. <h2>'.$title_text.'</h2>
  57. <p><a href="'.esc_url($btn_link).'" target="'.esc_attr($btn_target).'">'.esc_html($btn_title).'</a></p>
  58. </section>';
  59. return $output;
  60. });