vc-timeline.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Heading
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html__("Timeline", 'taskereasy'),
  7. "base" => "taskereasy_timeline",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html__("Add taskereasy timeline", 'taskereasy'),
  11. "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. "type" => "param_group",
  15. "heading" => esc_html__("Timeline List", 'taskereasy'),
  16. "param_name" => "timeline_list",
  17. "params" => array(
  18. array(
  19. "type" => "textfield",
  20. "heading" => esc_html__("Date", 'taskereasy'),
  21. "param_name" => "date_picker",
  22. ),
  23. array(
  24. "type" => "textfield",
  25. "heading" => esc_html__("Title", 'taskereasy'),
  26. "param_name" => "title",
  27. ),
  28. array(
  29. "type" => "textarea_safe",
  30. "heading" => esc_html__("Subtitle", 'taskereasy'),
  31. "param_name" => "subtext",
  32. ),
  33. )
  34. ),
  35. array(
  36. "type" => "textfield",
  37. "heading" => esc_html__("Class", 'taskereasy'),
  38. "param_name" => "class",
  39. ),
  40. array(
  41. 'type' => 'css_editor',
  42. 'heading' => esc_html__( 'CSS', 'taskereasy' ),
  43. 'param_name' => 'custom_design',
  44. 'group' => esc_html__( 'Design options', 'taskereasy' ),
  45. )
  46. )
  47. ));
  48. add_shortcode( 'taskereasy_timeline', function($atts, $content = null) {
  49. extract(shortcode_atts(array(
  50. 'date' => '',
  51. 'title' => '',
  52. 'subtext' => '',
  53. //'timeline_align' => 'left',
  54. 'class' => '',
  55. 'custom_design' => '',
  56. ), $atts));
  57. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  58. $time_list = vc_param_group_parse_atts( $atts['timeline_list'] );
  59. $class = html_entity_decode(vc_value_from_safe($class, true));
  60. //$time_align = html_entity_decode(vc_value_from_safe($timeline_align, true));
  61. $output = '';
  62. $count = 0;
  63. //$output .= print_r($time_list);
  64. $output .= '<div class="'.$class.'">';
  65. foreach ($time_list as $timeline) {
  66. if($count%2 == 0){
  67. $output .='
  68. <div class="journey-werp '.$custom_design.'">
  69. <div class="row">
  70. <div class="col-md-6">
  71. <div class="timeline text-right">
  72. <p><b>'.$time_list[$count]['date_picker'].'</b></p>
  73. </div>
  74. </div>
  75. <div class="col-md-6">
  76. <div class="journey-overview">
  77. <h4>'.$time_list[$count]['title'].'</h4>
  78. <p>'.$time_list[$count]['subtext'].'</p>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. ';
  84. $count++;
  85. }
  86. else
  87. {
  88. $output .='
  89. <div class="journey-werp '.$custom_design.'">
  90. <div class="row">
  91. <div class="col-md-6 order-md-12">
  92. <div class="timeline ">
  93. <p><b>'.$time_list[$count]['date_picker'].'</b></p>
  94. </div>
  95. </div>
  96. <div class="col-md-6">
  97. <div class="journey-overview text-right">
  98. <h4>'.$time_list[$count]['title'].'</h4>
  99. <p>'.$time_list[$count]['subtext'].'</p>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. ';
  105. $count++;
  106. }
  107. }
  108. $output .= '</div>';
  109. return $output;
  110. });