| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Youtube
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("Video", 'taskereasy'),
- "base" => "taskereasy_youtube",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy youtube", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "dropdown",
- "heading" => esc_html__("Style", 'taskereasy'),
- "param_name" => "style",
- "value" => array('Style 1' => 'style_1', 'Style 2' => 'style_2', 'Style 3' => 'style_3'),
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Link", 'taskereasy'),
- "param_name" => "youtube_link",
- "description" => 'Add Youtube link.'
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Title", 'taskereasy'),
- "param_name" => "title",
- 'dependency' => array(
- 'element' => 'style',
- 'value' => array('style_2', 'style_3')
- ),
- ),
- array(
- "type" => "textarea_safe",
- "heading" => esc_html__("Subtitle", 'taskereasy'),
- "param_name" => "subtext",
- 'dependency' => array(
- 'element' => 'style',
- 'value' => array('style_2', 'style_3')
- ),
- ),
- array(
- "type" => "textarea_safe",
- "heading" => esc_html__("Description", 'taskereasy'),
- "param_name" => "description",
- 'dependency' => array(
- 'element' => 'style',
- 'value' => array('style_2', 'style_3')
- ),
- ),
- array(
- "type" => "vc_link",
- "heading" => esc_html__("Button", 'taskereasy'),
- "param_name" => "button",
- "value" => '',
- 'dependency' => array(
- 'element' => 'style',
- 'value' => array('style_2', 'style_3')
- ),
- ),
- array(
- "type" => "attach_image",
- "heading" => esc_html__("Image Thumbnail", 'taskereasy'),
- "param_name" => "image",
- 'dependency' => array(
- 'element' => 'style',
- 'value' => array('style_2', 'style_3')
- ),
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- )
- )
- ));
- add_shortcode( 'taskereasy_youtube', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'youtube_link' => '',
- 'style' => 'style_1',
- 'title' => '',
- 'subtext' => '',
- 'description' => '',
- 'button' => '',
- 'image' => '',
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $youtube_url = html_entity_decode(vc_value_from_safe($youtube_link, true));
- $output = '';
- $output.='<div class="ta-video '.$custom_design . $style.'">';
- if($style == 'style_1'){
- $output .=
- '<div class="video_wrap">
- <div class="play-btn"> <a class="popup-youtube" href="'.$youtube_url.'"><i class="fa fa-play"></i></a> <span class="ripple"></span> <span class="ripple"></span> </div>
- </div>';
- }elseif($style == 'style_2'){
- $btnlink = vc_build_link( $button );
- $btn_link = !empty($btnlink['url']) ? $btnlink['url'] : '#';
- $btn_title = $btnlink['title'];
- $btn_target = !empty($btnlink['target']) ? $btnlink['target'] : '_self';
- $image_url = wp_get_attachment_image_src( $image, 'full' );
- $output.=
- '<div class="video-4-title video-3-title">'.$subtext.'</div>
- <div class="video-wrpr">
- <div class="video-container">';
- if($image_url[0]){
- $output .=
- '<div class="play-btn"> <a class="popup-youtube" href="'.$youtube_url.'"><i class="fa fa-play"></i></a> <span class="ripple"></span> <span class="ripple"></span> </div>
- <img src="'.$image_url[0].'" alt="Thumbnail">';
- }
- $output.='
- </div>
- <div class="video-content">
- <h2>'.$title.'</h2>
- <p>'.$description.'</p>
- ';
- if(!empty($btn_title)){
- $output.='<a href="'.$btn_link.'" target="'.$btn_target.'" class="btn">'.$btn_title.'</a>';
- }
- $output.='
- </div>
- </div>';
- }else{
- $btnlink = vc_build_link( $button );
- $btn_link = !empty($btnlink['url']) ? $btnlink['url'] : '#';
- $btn_title = $btnlink['title'];
- $btn_target = !empty($btnlink['target']) ? $btnlink['target'] : '_self';
- $image_url = wp_get_attachment_image_src( $image, 'full' );
- $output.=
- '<div class="video-4-title video-3-title">'.$subtext.'</div>
- <div class="video-wrpr">
- <div class="video-container">';
- if($image_url[0]){
- $output .=
- '<div class="play-btn"> <a class="popup-youtube" href="'.$youtube_url.'"><i class="fa fa-play"></i></a> <span class="ripple"></span> <span class="ripple"></span> </div>
- <img src="'.$image_url[0].'" alt="Thumbnail">';
- }
- $output.='
- </div>
- <div class="video-content">
- <h2>'.$title.'</h2>
- <p>'.$description.'</p>';
- if(!empty($btn_title)){
- $output.='<a href="'.$btn_link.'" target="'.$btn_target.'" class="btn">'.$btn_title.'</a>';
- }
- $output.='
- </div>
- </div>';
- }
- $output.='</div>';
- return $output;
- });
|