| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Heading
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("Slider", 'taskereasy'),
- "base" => "taskereasy_slider",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy Slider", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "param_group",
- "heading" => esc_html__("Slide", 'taskereasy'),
- "param_name" => "slide",
- "params" => array(
- array(
- "type" => "attach_image",
- "heading" => esc_html__("Image", 'taskereasy'),
- "param_name" => "image",
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Image Size", 'taskereasy'),
- "param_name" => "image_size",
- "description" => 'Enter image size (Example: "thumbnail", "medium", "large", "full" or other sizes defined by theme). Alternatively enter size in pixels (Example: 200x100 (Width x Height)).'
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Title", 'taskereasy'),
- "param_name" => "title",
- ),
- array(
- "type" => "textarea_safe",
- "heading" => esc_html__("Subtitle", 'taskereasy'),
- "param_name" => "subtext",
- ),
- array(
- "type" => "vc_link",
- "heading" => esc_html__("Button Link", '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' => 'textfield',
- 'heading' => esc_html__( 'Row ID', 'taskereasy' ),
- 'param_name' => 'id',
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- )
- )
- ));
- add_shortcode( 'taskereasy_slider', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'title' => '',
- 'subtext' => '',
- 'image' => '',
- 'image_size' => '',
- 'id' => '',
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $slides = vc_param_group_parse_atts( $atts['slide'] );
- $id = html_entity_decode(vc_value_from_safe($id, true));
- $output = '';
- $count = 0;
- //$output .= print_r($slides);
- $output .= '<div id="'.$id.'">
- <div class="owl-carousel">';
- foreach ($slides as $slide) {
- $img_id = $slides[$count]['image'];
- $img_size = $slides[$count]['image_size'];
- $imageurl = wp_get_attachment_image_src( $img_id, $img_size );
- $btnlink = vc_build_link( $slides[$count]['btn_link'] );
- $btn_url = $btnlink['url'];
- $btn_title = $btnlink['title'];
- $btn_target = $btnlink['target'];
- $output .='
- <div class="item" style="background-image:url('.$imageurl[0].')">
- <div class="intro-text">
- <h1>'.$slides[$count]['title'].'</h1>
- <p>'.$slides[$count]['subtext'].'</p>';
- if($slides[$count]['btn_style'] == 'style1'){
- $output .= '<a href="'.esc_url($btn_url).'" class="btn" target="'.esc_attr($btn_target).'" >'.esc_html($btn_title).' <i class="fa fa-angle-right"></i></a>';
- }
- if($slides[$count]['btn_style'] == 'style2'){
- $output .= '<a href="'.esc_url($btn_url).'" class="btn btn-secondary" target="'.esc_attr($btn_target).'" >'.esc_html($btn_title).' <i class="fa fa-angle-right"></i></a>';
- }
- $output .= ' </div>
- </div>
- ';
- $count++;
- }
- $output .= '</div></div>';
- return $output;
- });
|