113 lines
2.7 KiB
PHP
113 lines
2.7 KiB
PHP
<?php
|
|
/*
|
|
* Team Section
|
|
* Author: EM40
|
|
* Author URI: http://raytheme.com
|
|
* Version: 1.0
|
|
*/
|
|
|
|
/**
|
|
* =======================================================
|
|
* KC Shortcode Map
|
|
* =======================================================
|
|
*/
|
|
|
|
add_action('init', 'em_image_slide');
|
|
if(!function_exists('em_image_slide')):
|
|
function em_image_slide(){
|
|
if(function_exists('kc_add_map')):
|
|
kc_add_map(
|
|
array(
|
|
'em_image_slide' => array(
|
|
'name' => __( 'Single Image', 'cyber' ),
|
|
'title' => 'Em Image Slider Image',
|
|
'icon' => 'fa-photo',
|
|
'category' => 'cyber',
|
|
'wrapper_class' => 'clearfix',
|
|
'description' => __( 'Display Image style. This Elemement Only use for EM Image Slider.', 'cyber' ),
|
|
'params' => array(
|
|
'general' => array(
|
|
array(
|
|
'type' => 'toggle',
|
|
'label' => esc_html__( 'Set Image', 'cyber' ),
|
|
'name' => 'show_img',
|
|
'value' => 'yes',
|
|
'description' => esc_html__( 'you can show/hide image option.', 'cyber' )
|
|
),
|
|
|
|
array(
|
|
'type' => 'attach_image',
|
|
'name' => 'image',
|
|
'label' => esc_html__( 'Image', 'cyber' ),
|
|
'description' => esc_html__( 'Select image display For BG', 'cyber' ),
|
|
'relation' => array(
|
|
'parent' => 'show_img',
|
|
'show_when' => 'yes'
|
|
)
|
|
),
|
|
|
|
|
|
array(
|
|
'type' => 'text',
|
|
'label' => __( 'Custom class', 'cyber' ),
|
|
'name' => 'custom_class',
|
|
'description' => __( 'Enter extra custom class', 'cyber' )
|
|
)
|
|
),
|
|
)
|
|
),
|
|
)// first array
|
|
); // End add map
|
|
endif;
|
|
}
|
|
endif;
|
|
|
|
|
|
/**
|
|
* =======================================================
|
|
* Register Shortcode banner_slider section
|
|
* =======================================================
|
|
*/
|
|
// [em_image_slide title="" desc="" custom_css_class=""]
|
|
if(!function_exists('em_image_slide_function')){
|
|
function em_image_slide_function($atts,$content){
|
|
ob_start();
|
|
$em_image_slide = shortcode_atts(array(
|
|
'show_img' => '',
|
|
'image' => '',
|
|
'custom_css' => '',
|
|
'custom_class' => '',
|
|
),$atts);
|
|
extract( $em_image_slide );
|
|
//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="";
|
|
$images = wp_get_attachment_image_src( $image, 'full');
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<div class="em-single-imageslide">
|
|
<?php if( $show_img == 'yes' && !empty( $images ) ){ ?>
|
|
|
|
<img src="<?php echo esc_url( $images[0]); ?>" alt="image" />
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
return ob_get_clean();
|
|
}
|
|
add_shortcode('em_image_slide' ,'em_image_slide_function');
|
|
}
|