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

349 lines
13 KiB
PHP

<?php
add_action('init', 'cyber_post_tab_sections');
if(!function_exists('cyber_post_tab_sections')):
function cyber_post_tab_sections(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'cyber_post_tab' => array(
'name' => esc_html__('EM Post Tab', 'cyber'),
'description' => esc_html__('Display Tab Style', 'cyber'),
'icon' => 'kc-icon-tabs',
'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' => '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' => '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' => '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 h2 sup,.em_testi_degi'),
array('property' => 'font-family', 'label' => 'Font Family', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'font-weight', 'label' => 'Font Weight', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'text-transform', 'label' => 'Text Transform', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'margin', 'label' => 'Margin', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
array('property' => 'padding', 'label' => 'Padding', 'selector' => '+ .em_testi_title h2 sup,.em_testi_degi'),
),
'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'),
),
'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_post_tab',),
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '.em_single_post_tab:hover'),
array('property' => 'margin', 'label' => 'Margin'),
array('property' => 'padding', 'label' => 'Padding'),
array('property' => 'margin', 'label' => 'Position Hover', 'selector' => '.em_single_post_tab: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_post_tab_area')){
function cyber_post_tab_area( $atts , $content = null ){
ob_start();
// Attributes
$em_post_tab_box = shortcode_atts(array(
'layout' => '1',
'show_carousel' => '',
'set_column' => '2',
'post_type' => '',
'items' => '4',
'order' => '',
'gutter' => '',
'custom_css' => '',
'custom_class' => '',
),$atts);
extract( $em_post_tab_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_tab',
'posts_per_page' => intval( $items ),
'order' => $order,
);
$post_query = new WP_Query($args);
if( $post_query->have_posts() ) {
switch($layout){
case '2':
?>
<div class="em_tab_inner tab_post_style2">
<div class="col-md-12">
<ul class="em_tab_pils nav nav-pills">
<?php while ($post_query->have_posts()) : $post_query->the_post(); ?>
<?php $em_tab_menu = get_post_meta( get_the_ID(),'_cyber_em_tab_menu', true );?>
<?php $em_tab_active = get_post_meta( get_the_ID(),'_cyber_em_tab_active', true );?>
<?php $em_tab_icon = get_post_meta( get_the_ID(),'_cyber_em_tab_icon', true );?>
<?php $em_tab_image = get_post_meta( get_the_ID(),'_cyber_em_tab_image', true );?>
<li <?php if($em_tab_active){?> class="<?php echo $em_tab_active;?>" <?php }?> ><a <?php if($em_tab_image){?> style="background-image:url(<?php echo $em_tab_image; ?>);" <?php } ?> data-toggle="pill" href="#tab-<?php echo get_the_ID(); ?>"><i class="fa fa-<?php echo $em_tab_icon; ?>"></i><?php if($em_tab_menu){echo $em_tab_menu; }?></a></li>
<?php endwhile; ?>
</ul>
</div>
<div class="em_tab_content tab-content">
<?php while ($post_query->have_posts()) : $post_query->the_post(); ?>
<?php $em_tab_active = get_post_meta( get_the_ID(),'_cyber_em_tab_active', true );?>
<div id="tab-<?php echo get_the_ID(); ?>" class="tab-pane <?php if($em_tab_active){echo $em_tab_active;}?>">
<?php if(has_post_thumbnail()){?>
<div class="col-md-6">
<div class="em_post_tab_thumb">
<?php the_post_thumbnail();?>
</div>
</div>
<div class="col-md-6">
<div class="tab_pan_content">
<h2><?php the_title();?></h2>
<?php the_content();?>
</div>
</div>
<?php }else{?>
<div class="col-md-12">
<div class="tab_pan_content">
<h2><?php the_title();?></h2>
<?php the_content();?>
</div>
</div>
<?php } ?>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_query(); ?>
</div>
<?php
break;
default:
?>
<div class="em_tab_inner ">
<div class="col-md-12">
<ul class="em_tab_pils nav nav-pills">
<?php while ($post_query->have_posts()) : $post_query->the_post(); ?>
<?php $em_tab_menu = get_post_meta( get_the_ID(),'_cyber_em_tab_menu', true );?>
<?php $em_tab_active = get_post_meta( get_the_ID(),'_cyber_em_tab_active', true );?>
<?php $em_tab_icon = get_post_meta( get_the_ID(),'_cyber_em_tab_icon', true );?>
<?php $em_tab_image = get_post_meta( get_the_ID(),'_cyber_em_tab_image', true );?>
<li <?php if($em_tab_active){?> class="<?php echo $em_tab_active;?>" <?php }?> ><a <?php if($em_tab_image){?> style="background-image:url(<?php echo $em_tab_image; ?>);" <?php } ?> data-toggle="pill" href="#tab-<?php echo get_the_ID(); ?>"><i class="<?php echo $em_tab_icon; ?>"></i><?php if($em_tab_menu){echo $em_tab_menu; }?></a></li>
<?php endwhile; ?>
</ul>
</div>
<div class="em_tab_content tab-content">
<?php while ($post_query->have_posts()) : $post_query->the_post(); ?>
<?php $em_tab_active = get_post_meta( get_the_ID(),'_cyber_em_tab_active', true );?>
<div id="tab-<?php echo get_the_ID(); ?>" class="tab-pane <?php if($em_tab_active){echo $em_tab_active;}?>">
<?php if(has_post_thumbnail()){?>
<div class="col-md-6">
<div class="em_post_tab_thumb">
<?php the_post_thumbnail();?>
</div>
</div>
<div class="col-md-6">
<div class="tab_pan_content">
<h2><?php the_title();?></h2>
<?php the_content();?>
</div>
</div>
<?php }else{?>
<div class="col-md-12">
<div class="tab_pan_content">
<h2><?php the_title();?></h2>
<?php the_content();?>
</div>
</div>
<?php } ?>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_query(); ?>
</div>
<?php
break;
}
}
return ob_get_clean();
}
}
add_shortcode ('cyber_post_tab', 'cyber_post_tab_area' );