| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Heading
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("FAQs", 'taskereasy'),
- "base" => "taskereasy_faqs",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy faqs", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "param_group",
- "heading" => esc_html__("FAQs", 'taskereasy'),
- "param_name" => "faqs_list",
- "value" => '',
- "params" => array(
- array(
- "type" => "textfield",
- "heading" => esc_html__("Title", 'taskereasy'),
- "param_name" => "title",
- ),
- array(
- "type" => "textarea_safe",
- "heading" => esc_html__("Description", 'taskereasy'),
- "param_name" => "faq_description",
- ),
- array(
- "type" => "checkbox",
- "heading" => esc_html__("Show Icon", 'taskereasy'),
- "param_name" => "show_icon",
- ),
- array(
- "type" => "iconpicker",
- "heading" => esc_html__("Icon", 'taskereasy'),
- "param_name" => "faq_icon",
- "dependency" => array('element' => "show_icon", 'not_empty' => TRUE),
- ),
- array(
- "type" => "colorpicker",
- "heading" => esc_html__("Icon Color", 'taskereasy'),
- "param_name" => "icon_color",
- "dependency" => array('element' => "show_icon", 'not_empty' => TRUE),
- ),
- ),
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- ),
- )
- ));
- add_shortcode( 'taskereasy_faqs', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'faq_icon' => '',
- 'icon_color' => '#000000',
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $faqs_list = vc_param_group_parse_atts( $atts['faqs_list'] );
- $output = '';
- $count = 0;
- $showicon = ($faqs_list[$count]['show_icon'] == 'true') ? 'showicon' : '';
- $output .='<div id="accordion" class="'.$custom_design.'">';
- foreach ($faqs_list as $faq) {
- if($count == 0) { $show = 'show'; } else{ $show = '';}
- $output .= '<div class="card">
- <div class="card-header" id="heading'.esc_attr($count).'">
- <div class="btn btn-link '.esc_attr($showicon).'" data-toggle="collapse" data-target="#collapse-'.esc_attr($count).'" role="button" aria-expanded="true" aria-controls="collapse-'.esc_attr($count).'">';
- if($faqs_list[$count]['show_icon'] == 'true'){
- $output .= '<div class="list-icon" style="background-color: '.esc_attr($faqs_list[$count]['icon_color']).';"><i class="'.esc_attr($faqs_list[$count]['faq_icon']).'"></i></div>';
- }
- $output.= $faqs_list[$count]['title'].'
- </div>
- </div>
- <div id="collapse-'.esc_attr($count).'" class="collapse '.esc_attr($show).'" aria-labelledby="heading'.esc_attr($count).'" data-parent="#accordion">
- <div class="card-body">
- '.esc_html($faqs_list[$count]['faq_description']).'
- </div>
- </div>
- </div>';
- $count++;
- }
- $output .= '</div>
- ';
- return $output;
- });
|