| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Heading
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("Image with text", 'taskereasy'),
- "base" => "taskereasy_image_text",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy image with text", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "dropdown",
- "heading" => esc_html__("Style", 'taskereasy'),
- "param_name" => "img_style",
- "value" => array('Style 1' => 'style1', 'Style 2' => 'style2', 'Style 3' => 'style3', 'Style 4' => 'style4'),
- ),
- array(
- "type" => "param_group",
- "heading" => esc_html__("Image Block", 'taskereasy'),
- "param_name" => "img_block",
- "dependency" => array(
- 'element' => 'img_style',
- 'value' => 'style4'
- ),
- "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" => "textarea_safe",
- "heading" => esc_html__("Description", 'taskereasy'),
- "param_name" => "description",
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Number", 'taskereasy'),
- "param_name" => "number",
- ),
- ),
- ),
- array(
- "type" => "attach_image",
- "heading" => esc_html__("Image", 'taskereasy'),
- "param_name" => "image",
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Image Size", 'taskereasy'),
- "param_name" => "image_size",
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- "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",
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- ),
- array(
- "type" => "textarea_safe",
- "heading" => esc_html__("Subtitle", 'taskereasy'),
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- "param_name" => "subtext",
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Number", 'taskereasy'),
- "param_name" => "number",
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- ),
- array(
- "type" => "vc_link",
- "heading" => esc_html__("Button Link", 'taskereasy'),
- "param_name" => "btn_link",
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- "value" => ''
- ),
- array(
- 'type' => 'dropdown',
- 'heading' => esc_html__( 'Button Style', 'taskereasy' ),
- 'param_name' => 'btn_style',
- 'dependency' => array(
- 'element' => 'img_style',
- 'value' => array('style1', 'style2', 'style3')
- ),
- 'value' => array('Style 1' => 'style1', 'Style 2' => 'style2')
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- )
- )
- ));
- add_shortcode( 'taskereasy_image_text', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'img_style' => 'style1',
- 'image' => '',
- 'image_size' => 'full',
- 'title' => '',
- 'img_block' => '',
- 'subtext' => '',
- 'number' => '',
- 'btn_link' => '',
- 'btn_style' => 'style1',
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $imgstyle = html_entity_decode(vc_value_from_safe($img_style, true));
- $image_url = html_entity_decode(vc_value_from_safe($image, true));
- $img_size = html_entity_decode(vc_value_from_safe($image_size, true));
- $imageurl = wp_get_attachment_image_src( $image_url, $img_size );
- $title_text = html_entity_decode(vc_value_from_safe($title, true));
- $subtitle = html_entity_decode(vc_value_from_safe($subtext, true));
- $number = html_entity_decode(vc_value_from_safe($number, true));
- $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';
- $count = 0;
- $output = '';
- if($imgstyle == 'style1'){
- $output .='
- <section class="section-padding '.$custom_design.'">
- <div class="container">
- <div class="row">
- <div class="col-lg-6 order-md-12">
- <div class="about-info">
- <div class="p-0">
- <h2>'.$title_text.'</h2>
- </div>
- <p>'.$subtitle.'</p>';
- 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" target="'.esc_attr($btn_target).'">'.esc_html($btn_title).' <i class="fa fa-angle-right"></i></a>';
- }
- $output .= '</div>
- </div>
- <div class="col-lg-6">
- <div class="img-wrap">
- <img src="'.esc_url($imageurl[0]).'" alt="image">
- </div>
- </div>
- </div>
- </div>
- </section>';
- }
- if($imgstyle == 'style2'){
- $output .= '<div class="benefits-box">
- <div class="number-wp">'.esc_html($number).'</div>';
- if($imageurl[0]){
- $output .= '<img src="'.esc_url($imageurl[0]).'" alt="image">';
- }
- $output .= '<h5>'.esc_html($title_text).'</h5>
- <p>'.esc_html($subtitle).'</p>
- </div>';
- }
- if($imgstyle == 'style3'){
- $output .= '<div class="features_box">
- <div class="icon_wrap">
- <div class="icon_wrap-inner">';
- if($imageurl[0]){
- $output .= '<img src="'.esc_url($imageurl[0]).'" alt="icon">';
- }
- $output .= '</div></div>
- <h6>'.esc_html($title_text).'</h6>
- <p>'.esc_html($subtitle).'</p>
- </div>';
- }
- if($imgstyle == 'style4'){
- $img_block = vc_param_group_parse_atts( $atts['img_block'] );
- $output .='<div class="benefits-slider-wrapper center-slider">';
- foreach ($img_block as $block) {
- $img_id = $block['image'];
- $imgurl = wp_get_attachment_image_src($img_id, $img_size);
- $output .=
- '<div class="benefits-item">
- <div class="benefits-item-no">'.esc_html($block['number']).'</div>
- <div class="benefit-img-wrpr">';
- if(!empty($imgurl[0])){
- $output .= '<img src="'.esc_url($imgurl[0]).'" alt="icon">';
- }
- $output.='
- <h3>'.esc_html($block['subtext']).'</h3>
- </div>
- <div class="benefit-content-wrpr">
- <h6>'.esc_html($block['title']).'</h6>
- <p>'.esc_html($block['description']).'</p>
- </div>
- </div>';
- $count++;
- }
- $output.='</div>';
- }
- return $output;
- });
|