Files
Roman Pyrih f541250b59 Save
2026-03-06 15:14:23 +01:00

498 lines
17 KiB
PHP

<?php
add_action('init', 'cyber_case_study_sections');
if(!function_exists('cyber_case_study_sections')):
function cyber_case_study_sections(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'cyber_case_study' => array(
'name' => esc_html__('EM Case Study Section', 'cyber'),
'description' => esc_html__('Display Blog Style', 'cyber'),
'icon' => 'kc-icon-blog-posts',
'category' => 'cyber',
'params' => array(
'General' => array(
array(
'name' => 'items',
'label' => __( 'Items Limit', 'cyber' ),
'type' => 'number_slider',
'value' => '3',
'description' => __(' Specify number of post that you want to show. Set 0 to get all team', 'cyber'),
'options' => array(
'min' => 0,
'max' => 75,
'unit' => '',
'show_input' => false
)
),
array(
'type' => 'select',
'label' => __( 'Order By', 'cyber' ),
'name' => 'order',
'options' => array(
'DESC' => __( 'Descending', 'cyber' ),
'ASC' => __( 'Ascending', 'cyber' )
)
),
array(
'type' => 'radio_image',
'label' => __( 'Select blog 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' => __( 'When select style 2 that time, set column and set gutter not work', 'cyber' ),
'value' => '1'
),
array(
'type' => 'select',
'label' => __( 'Set Column', 'cyber' ),
'name' => 'set_column',
'description' => __( 'Enter number item per row', 'cyber' ),
'value' => '4',
'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(
'name' => 'show_content',
'label' => __( 'Display Pragraph', 'cyber' ),
'type' => 'toggle',
'value' => 'yes',
),
array(
'name' => 'show_button',
'label' => __( 'Display Button', 'cyber' ),
'type' => 'toggle',
'value' => 'yes',
),
array(
'type' => 'text',
'label' => __( 'Button Text', 'cyber' ),
'name' => 'btn_text',
'value' => 'Read More',
'description' => __( 'Enter Button Text', 'cyber' ),
'relation' => array(
'parent' => 'show_button',
'show_when' => 'yes',
)
),
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-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '.em-cases-study-title a:hover'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-cases-study-title h2 a,.em-cases-study-title a'),
),
'Desc' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.cases-study-content p'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.cases-study-content p'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.cases-study-content p'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.cases-study-content p'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.cases-study-content p'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.cases-study-content p'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.cases-study-content p'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.cases-study-content p'),
),
'Category' => array(
array('property' => 'color', 'label' => 'Color', 'selector' => '.case_category span'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.case_category span'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.case_category span'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.case_category span'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.case_category span'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.case_category span'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.case_category span'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.case_category span'),
),
'Button' => array(
array('property' => 'color', 'label' => 'Text Color', 'selector' => '.em-case-study-button a'),
array('property' => 'color', 'label' => 'Text Hover Color', 'selector' => '.em-case-study-button:hover'),
array('property' => 'border', 'label' => 'Border', 'selector' => '.em-case-study-button a'),
array('property' => 'border-color', 'label' => 'Hover Border', 'selector' => '.em-case-study-button a:hover'),
array('property' => 'background-color', 'label' => 'Background Color', 'selector' => '.em-case-study-button a'),
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '.em-case-study-button a:hover'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-case-study-button a'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-case-study-button a'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-case-study-button a'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-case-study-button a'),
),
'Content' => array(
array('property' => 'background', 'label' => 'BG Color', 'selector' => '.em-cases-study-content '),
array('property' => 'color', 'label' => 'Color', 'selector' => '.em-cases-study-content '),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '.em-cases-study-content '),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.em-cases-study-content'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.em-cases-study-content '),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '.em-cases-study-content'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '.em-cases-study-content '),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.em-cases-study-content '),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.em-cases-study-content '),
),
'Box' => array(
array('property' => 'background'),
array('property' => 'background-color', 'label' => 'BG Color', 'selector' => '+ .cyber-single-cases-study'),
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' => '+.cyber-single-cases-study',),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+.cyber-single-cases-study:hover'),
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '+.cyber-single-cases-study:hover')
)
)
)
)
),
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)// Params
)// end shortcode key
)// first array
); // End add map
endif;
}
endif;
// ========== blog Area
if(!function_exists('cyber_case_study_area')){
function cyber_case_study_area( $atts , $content = null ){
ob_start();
// Attributes
$em_blog_box = shortcode_atts(array(
'layout' => '1',
'set_column' => '3',
'show_pagination' => '',
'items' => '3',
'order' => '',
'gutter' => '',
'show_content' => '',
'show_button' => '',
'btn_text' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_blog_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 );
$page = ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1 );
$paged = ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : $page );
$args = array(
'post_type' => 'em_case_study',
'posts_per_page' => intval( $items ),
'order' => $order ,
'paged' => $paged,
'page' => $paged
);
$the_query = new WP_Query($args);
if( $the_query->have_posts() ) {
switch ( $layout ) {
case '2':
?>
<div class=" blog_style_adn_2 _1">
<div class="blog_wrap case_study_carousel owl-carousel curosel-style">
<?php while ($the_query->have_posts()) : $the_query->the_post();
?>
<!-- single blog -->
<div class=" <?php if( $gutter == 'yes' ){echo 'blog_nospace_adn';}?> col-md-12 col-xs-12 col-sm-12 " >
<div class="single_case_study <?php echo esc_attr( $extra_class ); ?>">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="cyber-single-cases-study ">
<!-- BLOG THUMB -->
<?php if(has_post_thumbnail()){?>
<div class="case-study-thumb">
<a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(); ?></a>
</div>
<?php } ?>
<div class="em-cases-study-content">
<a href="<?php the_permalink(); ?>" class="em-cases-study-content-link"></a>
<!-- BLOG TITLE -->
<div class="em-cases-study-title ">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="case_category">
<?php
switch(get_the_title()){
case 'Nokia':
{
echo '<span>Finland</span>';
break;
}
case 'SoftServe':
{
echo '<span>Ukraine / USA</span>';
break;
}
case 'Microsoft Corporation':
{
echo '<span>USA</span>';
break;
}
case 'Mynavi Corporation':
{
echo '<span>Japan</span>';
break;
}
case 'Striped Giraffe':
{
echo '<span>Germany</span>';
break;
}
case 'DPDGroup IT Solutions':
{
echo '<span>France</span>';
break;
}
case 'Atlassian':
{
echo '<span>Australia</span>';
break;
}
case 'ICEYE':
{
echo '<span>Poland / Finland</span>';
break;
}
case 'TomTom':
{
echo '<span>The Netherlands</span>';
break;
}
case 'Equinix, Inc.':
{
echo '<span>USA</span>';
break;
}
case 'Kitopi':
{
echo '<span>UAE</span>';
break;
}
case 'Intetics':
{
echo '<span>USA</span>';
break;
}
}
?>
</div>
<!-- Blog Description -->
<?php if($show_content=='yes'){?>
<!-- BLOG TITLE AND CONTENT -->
<div class="em-cases-study-inner ">
<div class="cases-study-content ">
<p><?php echo wp_trim_words( get_the_content(), 19, ' ' ); ?></p>
</div>
</div>
<?php } ?>
<!-- Blog Read More Button -->
<?php if($show_button=='yes'){?>
<div class="em-case-study-button">
<?php if($btn_text){?>
<a href="<?php the_permalink(); ?>" class="learn_btn"><?php echo $btn_text;?></a>
<i class="fa fa-long-arrow-right btn_icon"></i>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div> <!-- END SINGLE BLOG -->
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
</div>
<?php
break;
default:
?>
<div class=" blog_style_adn_2 _2">
<div class="blog_wrap case_study_carousel_main owl-carousel curosel-style style-one">
<?php while ($the_query->have_posts()) : $the_query->the_post();
?>
<!-- single blog -->
<div class=" <?php if( $gutter == 'yes' ){echo 'blog_nospace_adn';}?> col-md-12 col-xs-12 col-sm-12 " >
<div class="single_case_study <?php echo esc_attr( $extra_class ); ?>">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="cyber-single-cases-study ">
<!-- BLOG THUMB -->
<?php if(has_post_thumbnail()){?>
<div class="case-study-thumb ">
<a href="<?php the_permalink(); ?>"> <?php the_post_thumbnail(); ?>
</a>
</div>
<?php } ?>
<div class="em-cases-study-content ">
<!-- BLOG TITLE -->
<div class="em-cases-study-title ">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="case_category">
<span>Marketing /</span>
<span>Design</span>
</div>
<!-- Blog Description -->
<?php if($show_content=='yes'){?>
<!-- BLOG TITLE AND CONTENT -->
<div class="em-cases-study-inner ">
<div class="cases-study-content ">
<p><?php echo wp_trim_words( get_the_content(), 19, ' ' ); ?></p>
</div>
</div>
<?php } ?>
<!-- Blog Read More Button -->
<?php if($show_button=='yes'){?>
<div class="em-case-study-button">
<?php if($btn_text){?>
<a href="<?php the_permalink(); ?>" class="learn_btn"><?php echo $btn_text;?></a>
<i class="fa fa-long-arrow-right btn_icon"></i>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</div> <!-- END SINGLE BLOG -->
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
</div>
<?php
break;
}
} //end have
return ob_get_clean();
}
}
add_shortcode ('cyber_case_study', 'cyber_case_study_area' );