301 lines
10 KiB
PHP
301 lines
10 KiB
PHP
<?php
|
|
/*
|
|
* em video Section
|
|
* Author: EM40
|
|
* Author URI: http://raytheme.com
|
|
* Version: 1.0
|
|
*/
|
|
|
|
/**
|
|
* =======================================================
|
|
* KC Shortcode Map
|
|
* =======================================================
|
|
*/
|
|
|
|
add_action('init', 'em_video');
|
|
if(!function_exists('em_video')):
|
|
function em_video(){
|
|
if(function_exists('kc_add_map')):
|
|
kc_add_map(
|
|
array(
|
|
'em_video' => array(
|
|
'name' => __( 'EM video Box', 'cyber' ),
|
|
'title' => 'video Settings',
|
|
'icon' => 'fa-youtube-play',
|
|
'category' => 'cyber',
|
|
'wrapper_class' => 'clearfix',
|
|
'description' => __( 'Display Service style.', 'cyber' ),
|
|
'params' => array(
|
|
'general' => array(
|
|
|
|
array(
|
|
'type' => 'radio_image',
|
|
'label' => __( 'Select Feature Style', 'cyber' ),
|
|
'name' => 'layout',
|
|
'admin_label' => true,
|
|
'options' => array(
|
|
'1' => EM40_EXTENSION_URI . 'asstes/images/blog/layout1.jpg',
|
|
'2' => EM40_EXTENSION_URI . 'asstes/images/blog/layout2.jpg',
|
|
),
|
|
'description' => __( 'Select Your Feature Style', 'cyber' ),
|
|
'value' => '1'
|
|
),
|
|
|
|
array(
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Set Image', 'cyber' ),
|
|
'name' => 'show_img',
|
|
'value' => 'no',
|
|
'description' => esc_html__( 'set bg image.', 'cyber' )
|
|
),
|
|
|
|
array(
|
|
'type' => 'attach_image',
|
|
'name' => 'image',
|
|
'label' => esc_html__( 'Image', 'cyber' ),
|
|
'description' => esc_html__( 'Select image display after icon', 'cyber' ),
|
|
'relation' => array(
|
|
'parent' => 'show_img',
|
|
'show_when' => 'yes'
|
|
)
|
|
),
|
|
array(
|
|
'name' => 'icon',
|
|
'label' => __( 'Select Icon', 'cyber' ),
|
|
'type' => 'icon_picker',
|
|
'description' => __( 'Select icon display in box', 'cyber' ),
|
|
'value' => 'fa-youtube-play',
|
|
),
|
|
array(
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Set Youtube', 'cyber' ),
|
|
'name' => 'show_youtube',
|
|
'value' => 'yes',
|
|
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => __( 'Youtube Video link', 'cyber' ),
|
|
'name' => 'em_youtube',
|
|
'description' => __( 'Enter the Youtube URL. For example: https://youtu.be/BS4TUd7FJSg', 'cyber' ),
|
|
'admin_label' => true,
|
|
'value' => 'https://youtu.be/BS4TUd7FJSg',
|
|
'relation' => array(
|
|
'parent' => 'show_youtube',
|
|
'show_when' => 'yes'
|
|
)
|
|
),
|
|
array(
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Set Vimeo', 'cyber' ),
|
|
'name' => 'show_vimeo',
|
|
'value' => 'no',
|
|
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'label' => __( 'Vimeo Video link', 'cyber' ),
|
|
'name' => 'em_vimeo',
|
|
'description' => __( 'Enter the Vimeo URL. For example: https://vimeo.com/174008281', 'cyber' ),
|
|
'admin_label' => true,
|
|
'value' => 'https://vimeo.com/174008281',
|
|
'relation' => array(
|
|
'parent' => 'show_vimeo',
|
|
'show_when' => 'yes'
|
|
)
|
|
),
|
|
array(
|
|
'type' => 'text',
|
|
'name' => 'title',
|
|
'label' => __( 'Name', 'cyber' ),
|
|
'value' => 'OUR AWESOME VIDEO',
|
|
'admin_label' => true
|
|
),
|
|
|
|
array(
|
|
'type' => 'text',
|
|
'label' => __( 'Custom class', 'cyber' ),
|
|
'name' => 'custom_class',
|
|
'description' => __( 'Enter extra custom class', 'cyber' )
|
|
)
|
|
),
|
|
|
|
|
|
'styling' => array(
|
|
array(
|
|
'name' => 'css_custom',
|
|
'type' => 'css',
|
|
'options' => array(
|
|
array(
|
|
"screens" => "any,1024,999,767,479",
|
|
'Title' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.choose-video-icon h3'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.choose-video-icon h3'),
|
|
),
|
|
'Icon' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.video-icon a i'),
|
|
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '+:hover .video-icon a i'),
|
|
array('property' => 'background-color', 'label' => 'Background Color', 'selector' => '.video-icon a i'),
|
|
array('property' => 'border', 'label' => 'Border', 'selector' => '.video-icon a i'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.video-icon a i'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.video-icon a i'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.video-icon a i')
|
|
),
|
|
'Box' => array(
|
|
array('property' => 'background'),
|
|
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover'),
|
|
array('property' => 'text-align', 'label' => 'Box Text Align'),
|
|
array('property' => 'border', 'label' => 'Border'),
|
|
array('property' => 'border-color', 'label' => 'Border Color Hover'),
|
|
array('property' => 'display', 'label' => 'Display'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => '+.em-video'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+.em-video:hover'),
|
|
array('property' => 'margin', 'label' => 'Margin'),
|
|
array('property' => 'padding', 'label' => 'Padding'),
|
|
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '+.em-video:hover')
|
|
)
|
|
)
|
|
)
|
|
)
|
|
),
|
|
'animate' => array(
|
|
array(
|
|
'name' => 'animate',
|
|
'type' => 'animate'
|
|
)
|
|
),
|
|
)
|
|
),
|
|
|
|
|
|
|
|
)// first array
|
|
); // End add map
|
|
endif;
|
|
}
|
|
endif;
|
|
|
|
|
|
|
|
|
|
/**
|
|
* =======================================================
|
|
* Register Shortcode team section
|
|
* =======================================================
|
|
*/
|
|
// [em_video title="" desc="" icon=""]
|
|
|
|
|
|
|
|
if(!function_exists('em_video_shortcode')){
|
|
|
|
|
|
function em_video_shortcode($atts,$content){
|
|
ob_start();
|
|
|
|
$em_video = shortcode_atts(array(
|
|
'icon' => '',
|
|
'title' => '',
|
|
'show_img' => '',
|
|
'image' => '',
|
|
'show_youtube' => '',
|
|
'em_youtube' => '',
|
|
'show_vimeo' => '',
|
|
'em_vimeo' => '',
|
|
'layout' => '1',
|
|
'custom_css' => '',
|
|
'custom_class' => '',
|
|
),$atts);
|
|
extract( $em_video );
|
|
//custom class
|
|
$wrap_class = apply_filters( 'kc-el-class', $atts );
|
|
if( !empty( $custom_class ) ):
|
|
$wrap_class[] = $custom_class;
|
|
endif;
|
|
$extra_class = implode( ' ', $wrap_class );
|
|
$images = wp_get_attachment_image_src( $image, 'full');
|
|
|
|
|
|
switch($layout){
|
|
case'2':
|
|
?>
|
|
<div class="single-video style_two <?php echo esc_attr( $extra_class ); ?>">
|
|
<?php if( $show_img == 'yes' && !empty( $images ) ){ ?>
|
|
<div class="em-video-image">
|
|
<img src="<?php echo esc_url( $images[0] ); ?>" alt="insert image" />
|
|
</div>
|
|
<?php } ?>
|
|
<div class="choose-video-icon">
|
|
<?php if( !empty( $icon ) ){ ?>
|
|
<div class="video-icon">
|
|
<?php if( $show_youtube == 'yes' && !empty( $em_youtube ) ){ ?>
|
|
<a class="video-vemo-icon venobox vbox-item" data-vbtype="youtube" data-autoplay="true" href="<?php echo $em_youtube; ?>"><i class="<?php echo esc_attr( $icon ); ?>"></i></a>
|
|
<?php } ?>
|
|
<?php if( $show_vimeo == 'yes' && !empty( $em_vimeo ) ){ ?>
|
|
<a class="video-vemo-icon venobox vbox-item" data-vbtype="youtube" data-autoplay="true" href="<?php echo $em_vimeo; ?>"><i class="<?php echo esc_attr( $icon ); ?>"></i></a>
|
|
<?php } ?>
|
|
<?php if ( !empty( $title ) ) {?>
|
|
<h3>
|
|
<?php echo $title; ?>
|
|
</h3>
|
|
<?php }?>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
break;
|
|
default:
|
|
?>
|
|
<div id="parallax-video" class="single-video <?php echo esc_attr( $extra_class ); ?>">
|
|
<div class="slider-shape layer-1 layer" data-depth="0.50"><img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/NW.jpg'; ?>" alt="01"></div>
|
|
<div class="slider-shape layer-2 layer" data-depth="0.45"><img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/NE.jpg'; ?>" alt="02"></div>
|
|
<div class="slider-shape layer-3 layer" data-depth="0.35"><img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/SW.jpg'; ?>" alt="03"></div>
|
|
<div class="slider-shape layer-4 layer" data-depth="0.30"><img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/SE.jpg'; ?>" alt="04"></div>
|
|
|
|
<?php if( $show_img == 'yes' && !empty( $images ) ){ ?>
|
|
<div class="em-video-image">
|
|
<img src="<?php echo esc_url( $images[0] ); ?>" alt="insert image" />
|
|
</div>
|
|
<?php } ?>
|
|
|
|
<div class="choose-video-icon">
|
|
<?php if( !empty( $icon ) ){ ?>
|
|
|
|
<div class="video-icon">
|
|
<?php if( $show_youtube == 'yes' && !empty( $em_youtube ) ){ ?>
|
|
<a class="video-vemo-icon venobox vbox-item" data-vbtype="youtube" data-autoplay="true" href="<?php echo $em_youtube; ?>"><i class="<?php echo esc_attr( $icon ); ?>"></i></a>
|
|
|
|
<?php } ?>
|
|
<?php if( $show_vimeo == 'yes' && !empty( $em_vimeo ) ){ ?>
|
|
<a class="video-vemo-icon venobox vbox-item" data-vbtype="youtube" data-autoplay="true" href="<?php echo $em_vimeo; ?>"><i class="<?php echo esc_attr( $icon ); ?>"></i></a>
|
|
|
|
<?php } ?>
|
|
<?php if ( !empty( $title ) ) {?>
|
|
<h3>
|
|
<?php echo $title; ?>
|
|
</h3>
|
|
<?php }?>
|
|
</div>
|
|
<?php } ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
|
|
return ob_get_clean();
|
|
}
|
|
add_shortcode('em_video','em_video_shortcode');
|
|
|
|
}
|
|
|