Files
doitinpoland.com/wp-content/plugins/em-helper-plugin/includes/shortcodes/em_testimonial.php
2023-09-12 21:41:04 +02:00

616 lines
22 KiB
PHP

<?php
add_action('init', 'cyber_testimonial_sections');
if(!function_exists('cyber_testimonial_sections')):
function cyber_testimonial_sections(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'cyber_testimonial' => array(
'name' => esc_html__('EM Testimonial', 'cyber'),
'description' => esc_html__('Display Testimonial Style', 'cyber'),
'icon' => 'et-chat',
'category' => 'cyber',
'params' => array(
'General' => array(
array(
'name' => 'show_carousel',
'type' => 'toggle',
'label' => esc_html__( 'Show/Hide carousel', 'cyber' ),
'value' => 'yes',
'description' => esc_html__( 'If you set yes, that time Set Column and gutter not work.', 'cyber' )
),
array(
'name' => 'items',
'label' => __( 'Items Limit', 'cyber' ),
'type' => 'number_slider',
'value' => '8',
'description' => __(' Specify number of post that you want to show. Set 0 to get all team', 'cyber'),
'options' => array(
'min' => 0,
'max' => 15,
'unit' => '',
'show_input' => false
)
),
array(
'type' => 'select',
'label' => __( 'Order By', 'cyber' ),
'name' => 'order',
'options' => array(
'DESC' => __( 'Descending', 'cyber' ),
'ASC' => __( 'Ascending', 'cyber' )
)
),
array(
'type' => 'select',
'label' => __( 'Set Column', 'cyber' ),
'name' => 'set_column',
'description' => __( 'Enter number item per row', 'cyber' ),
'value' => '6',
'options' => array(
'12' => __( '1 Column', 'cyber' ),
'6' => __( '2 Column', 'cyber' ),
'4' => __( '3 Column', 'cyber' ),
'3' => __( '4 Column', 'cyber' )
),
),
array(
'name' => 'gutter',
'label' => __( 'Select No Gutter', 'cyber' ),
'type' => 'toggle',
'value' => 'no',
'description' => __( 'Remove column Spacing', 'cyber' ),
),
array(
'type' => 'radio_image',
'label' => __( 'Select Team 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 Team Style', 'cyber' ),
'value' => '1'
),
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' => '+ .em_testi_title h2 '),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '+ .em_testi_title h2 '),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '+ .em_testi_title h2 '),
),
'Degi' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '+ .em_testi_title span '),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '+ .em_testi_title span'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '+ .em_testi_title span'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '+ .em_testi_title span'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '+ .em_testi_title span'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '+ .em_testi_title span'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '+ .em_testi_title span'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '+ .em_testi_title span'),
),
'Desc' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.em_testi_text'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em_testi_text'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em_testi_text'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em_testi_text'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em_testi_text'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em_testi_text'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em_testi_text'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em_testi_text'),
),
'Image' => array(
array('property' => 'height', 'label' => 'Height', 'selector' => '+ .em_test_thumb img'),
array('property' => 'width', 'label' => 'Width', 'selector' => '+ .em_test_thumb img'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '+ .em_test_thumb img'),
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '+ .em_test_thumb img'),
),
'Dots' => array(
array('property' => 'border', 'label' => 'Border','selector' => '.owl-dots .owl-dot'),
),
'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_single_testimonial',),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '.em_single_testimonial:hover'),
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '.em_single_testimonial:hover')
),
)
)
)
),
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)// Params
)// end shortcode key
)// first array
); // End add map
endif;
}
endif;
// ========== Portfolio Area
if(!function_exists('cyber_testimonial_area')){
function cyber_testimonial_area( $atts , $content = null ){
ob_start();
// Attributes
$em_testimonial_box = shortcode_atts(array(
'layout' => '1',
'show_carousel' => '',
'set_column' => '2',
'post_type' => '',
'items' => '4',
'order' => '',
'gutter' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_testimonial_box );
//custom class
$wrap_class = apply_filters( 'kc-el-class', $atts );
if( !empty( $custom_class ) ):
$wrap_class[] = $custom_class;
endif;
$extra_class = implode( ' ', $wrap_class );
$args = array(
'post_type' => 'em_testimonial',
'posts_per_page' => intval( $items ),
'order' => $order,
);
$post_query = new WP_Query($args);
switch($layout){
case'2':
if( $post_query->have_posts() ) { ?>
<?php if($show_carousel=='yes'){?>
<div class="testimonial_list2 owl-carousel curosel-style testimonial-style-two">
<?php while ( $post_query->have_posts() ) {$post_query->the_post();
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );
$em_rating = get_post_meta( get_the_ID(),'_cyber_em_rating', true );?>
<!-- SINGLE TEAM -->
<div class="col-md-12">
<!-- Start Single Testimonial -->
<div class="em_single_testimonial <?php echo esc_attr( $extra_class ); ?>">
<?php if(has_post_thumbnail()){?>
<div class="em_test_thumb">
<?php the_post_thumbnail();?>
</div>
<?php } ?>
<div class="em_testi_content">
<div class="em_testi_text">
<?php echo get_the_content();?>
</div>
</div>
<div class="em_reviews_rating">
<?php if($em_rating==5){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
</div>
<?php }elseif($em_rating==4){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==3){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==2){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==1){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }else{}?>
</div>
<div class="em_testi_title">
<h2><?php the_title(); ?> <span><?php if($testi_deg){echo $testi_deg;}?></span></h2>
</div>
</div>
</div>
<?php } //END WHILE ?>
</div>
<?php }else{ ?>
<?php while ($post_query->have_posts()) : $post_query->the_post();
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );
$em_rating = get_post_meta( get_the_ID(),'_cyber_em_rating', true );
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );?>
<!-- single portfolio -->
<div class=" <?php if( $gutter == 'yes' ){echo 'nospace-testi';}?> col-lg-<?php if( !empty( $set_column ) ){echo $set_column;}?> testi-column col-md-6 col-sm-12 " >
<!-- Start Single Testimonial -->
<div class="em_single_testimonial testimonial-style-two <?php echo esc_attr( $extra_class ); ?>">
<?php if(has_post_thumbnail()){?>
<div class="em_test_thumb">
<?php the_post_thumbnail();?>
</div>
<?php } ?>
<div class="em_testi_content">
<div class="em_testi_text">
<?php echo get_the_content();?>
</div>
</div>
<div class="em_reviews_rating">
<?php if($em_rating==5){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
</div>
<?php }elseif($em_rating==4){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==3){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==2){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==1){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }else{}?>
</div>
<div class="em_testi_title">
<h2><?php the_title(); ?> <span><?php if($testi_deg){echo $testi_deg;}?></span></h2>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<?php } ?>
<?php }
break;
default:
if( $post_query->have_posts() ) { ?>
<?php if($show_carousel=='yes'){?>
<div class="testimonial_list owl-carousel curosel-style">
<?php while ( $post_query->have_posts() ) {$post_query->the_post();
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );
$em_rating = get_post_meta( get_the_ID(),'_cyber_em_rating', true );?>
<!-- SINGLE TEAM -->
<div class="col-md-12">
<!-- Start Single Testimonial -->
<div class="em_single_testimonial default-style <?php echo esc_attr( $extra_class ); ?>">
<?php if(has_post_thumbnail()){?>
<div class="em_test_thumb">
<?php the_post_thumbnail();?>
</div>
<?php } ?>
<div class="em_testi_content">
<div class="em_testi_text">
<?php echo get_the_content();?>
</div>
</div>
<div class="em_reviews_rating">
<?php if($em_rating==5){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
</div>
<?php }elseif($em_rating==4){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==3){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==2){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==1){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }else{}?>
</div>
<div class="em_testi_title">
<h2><?php the_title(); ?> <span><?php if($testi_deg){echo $testi_deg;}?></span></h2>
</div>
</div>
</div>
<?php } //END WHILE ?>
</div>
<?php }else{ ?>
<?php while ($post_query->have_posts()) : $post_query->the_post();
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );
$em_rating = get_post_meta( get_the_ID(),'_cyber_em_rating', true );
$testi_deg = get_post_meta( get_the_ID(),'_cyber_testi_deg', true );?>
<!-- single portfolio -->
<div class=" <?php if( $gutter == 'yes' ){echo 'nospace-testi';}?> col-lg-<?php if( !empty( $set_column ) ){echo $set_column;}?> testi-column col-md-6 col-sm-12 " >
<!-- Start Single Testimonial -->
<div class="em_single_testimonial default-style <?php echo esc_attr( $extra_class ); ?>">
<?php if(has_post_thumbnail()){?>
<div class="em_test_thumb">
<?php the_post_thumbnail();?>
</div>
<?php } ?>
<div class="em_testi_content">
<div class="em_testi_text">
<?php echo get_the_content();?>
</div>
</div>
<div class="em_reviews_rating">
<?php if($em_rating==5){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
</div>
<?php }elseif($em_rating==4){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==3){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==2){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }elseif($em_rating==1){?>
<div class="testi-star">
<i class="fa fa-star active"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div>
<?php }else{}?>
</div>
<div class="em_testi_title">
<h2><?php the_title(); ?> <span><?php if($testi_deg){echo $testi_deg;}?></span></h2>
</div>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<?php } ?>
<?php }
break;
}
return ob_get_clean();
}
}
add_shortcode ('cyber_testimonial', 'cyber_testimonial_area' );