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

1 line
13 KiB
PHP

<?php
/*
* =======================================================
* KC Shortcode Map - SECTION TITLE
* =======================================================
*/
add_action('init', 'em_section_title');
if(!function_exists('em_section_title')):
function em_section_title(){
if(function_exists('kc_add_map')):
kc_add_map(
array(
'em_section_title' => array(
'name' => esc_html__('EM Section Title', 'cyber'),
'description' => esc_html__('Display Title', 'cyber'),
'icon' => 'kc-icon-title',
'category' => 'cyber',
'params' => array(
/* .............................................
Content
............................................. */
'General' => array(
array(
'type' => 'radio_image',
'label' => __( 'Select Title 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 Title style', 'cyber' ),
'value' => '1'
),
array(
'name' => 'title',
'label' => esc_html__('Title','cyber'),
'type' => 'text',
'admin_label' => true,
'value' => 'SELECT YOUR TITLE'
),
array(
'name' => 'title2',
'label' => esc_html__('Title Two','cyber'),
'type' => 'text',
'admin_label' => true,
'value' => 'Type Title Two'
),
array(
'name' => 'title_highlight',
'label' => esc_html__('Highlight Text','cyber'),
'type' => 'text',
'admin_label' => true,
'value' => 'title'
),
array(
'name' => 'title_sub',
'label' => esc_html__('Sub Title','cyber'),
'type' => 'text',
'admin_label' => true,
'value' => 'Your Sub Title'
),
/* icon option */
array(
'name' => 'title_icon',
'type' => 'toggle',
'label' => esc_html__( 'Set Icon', 'cyber' ),
'value' => 'no',
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
),
array(
'type' => 'icon_picker',
'name' => 'icon',
'label' => esc_html__( 'Icon', 'cyber' ),
'value' => 'sl-rocket',
'description' => esc_html__( 'Select icon display on front side', 'cyber' ),
'relation' => array(
'parent' => 'title_icon',
'show_when' => 'yes'
)
),
/* bar option */
array(
'type' => 'toggle',
'label' => esc_html__( 'Show Bar', 'cyber' ),
'name' => 'show_bar',
'value' => 'yes',
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
),
/* image option */
array(
'type' => 'toggle',
'label' => esc_html__( 'Set Image', 'cyber' ),
'name' => 'show_img',
'value' => 'no',
'description' => esc_html__( 'you can show icon after your heading.', 'cyber' )
),
array(
'type' => 'attach_image',
'name' => 'image',
'label' => esc_html__( 'Image', 'cyber' ),
'description' => esc_html__( 'Select image display after heading', 'cyber' ),
'relation' => array(
'parent' => 'show_img',
'show_when' => 'yes'
)
),
array(
'name' => 'description',
'label' => esc_html__('Description','cyber'),
'type' => 'textarea',
'value' => base64_encode('Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt.')
),
array(
'name' => 'title_lr',
'label' => 'Title Position',
'type' => 'select',
'options' => array(
't_left' => 'Title Left',
't_center' => 'Title Center',
't_right' => 'Title Right'
),
'value' => 't_center',
'description' => 'set your title position',
),
array(
'name' => 'custom_css_class',
'label' => esc_html__('CSS Class','cyber'),
'description' => esc_html__('Add Custom css class for styling','cyber'),
'type' => 'text'
),
),
'styling' => array(
array(
'name' => 'custom_css',
'type' => 'css',
'options' => array(
array(
'screens' => 'any,480,768,992,1024',
'Title Text' => array(
array('property' => 'color', 'label' => esc_html__('Color','cyber'), 'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'font-size', 'label' => esc_html__('Font Size','cyber'), 'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'font-weight', 'label' => esc_html__('Font Weight','cyber'), 'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'text-transform', 'label' => esc_html__('Text Transform','cyber'), 'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'letter-spacing', 'label' => esc_html__('Letter Spacing','cyber'), 'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'margin', 'label' => esc_html__('Margin','cyber'),'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'padding', 'label' => esc_html__('Padding','cyber'),'selector' => '+ .section-title h2,.title_tx h2'),
array('property' => 'display', 'label' => esc_html__('Display','cyber'),'selector' => '+ .section-title h2,.title_tx h2'),
),
'Sub Title Text' => array(
array('property' => 'color', 'label' => esc_html__('Color','cyber'), 'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'font-size', 'label' => esc_html__('Font Size','cyber'), 'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'font-weight', 'label' => esc_html__('Font Weight','cyber'), 'selector' => '+ .section-title h5,,.title_tx h5'),
array('property' => 'text-transform', 'label' => esc_html__('Text Transform','cyber'), 'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'letter-spacing', 'label' => esc_html__('Letter Spacing','cyber'), 'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'margin', 'label' => esc_html__('Margin','cyber'),'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'padding', 'label' => esc_html__('Padding','cyber'),'selector' => '+ .section-title h5,.title_tx h5'),
array('property' => 'display', 'label' => esc_html__('Display','cyber'),'selector' => '+ .section-title h5,.title_tx h5'),
),
'Highlight Text' => array(
array('property' => 'color', 'label' => esc_html__('Text Color & Icon Color ','cyber'), 'selector' => '+ .section-title h2 span,.title_tx h2 span,.em-icon i'),
array('property' => 'background-color', 'label' => esc_html__('Title Bar Color','cyber'), 'selector' => '+ .em-bar,.title_in::before,.title_in::after'),
),
'description Text' => array(
array('property' => 'color', 'label' => esc_html__('Color','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'font-size', 'label' => esc_html__('Font Size','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'font-weight', 'label' => esc_html__('Font Weight','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'text-transform', 'label' => esc_html__('Text Transform','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'letter-spacing', 'label' => esc_html__('Letter Spacing','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'line-height', 'label' => esc_html__('Line Height','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'width', 'label' => esc_html__('Width','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'height', 'label' => esc_html__('Height','cyber'), 'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'margin', 'label' => esc_html__('Margin','cyber'),'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'padding', 'label' => esc_html__('Padding','cyber'),'selector' => '+ .section-title p,.title_ptx p'),
array('property' => 'display', 'label' => esc_html__('Display','cyber'),'selector' => '+ .section-title p,.title_ptx p'),
),
)
) //End of options
)
), //End of styling
'animate' => array(
array(
'name' => 'animate',
'type' => 'animate'
)
),
)
)
)
); // End add map
endif;
}
endif;
// [em_section_title title="" title_highlight="" title_icon="" show_bar="" show_img="" description="" custom_css_class=""]
if(!function_exists('cyber_section_title_shortcode')){
function cyber_section_title_shortcode($atts,$content){
ob_start();
$cyber_section_title = shortcode_atts(array(
'layout' => '1',
'title' => '',
'title2' => '',
'type' => '',
'title_highlight' => '',
'title_sub' => '',
'title_icon' => '',
'title_lr' => '',
'icon' => '',
'show_bar' => '',
'show_img' => '',
'image' => '',
'description' => '',
'custom_css' => '',
'custom_css_class' => '',
),$atts);
extract( $cyber_section_title );
//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="<?php echo esc_attr( $extra_class ); ?> <?php echo esc_attr($custom_css_class); ?>">
<div class="title_in_area">
<div class="title_in">
<div class="title_tx">
<?php if($title_sub){?>
<h5><?php echo esc_html($title_sub);?></h5>
<?php } ?>
<h2><?php echo esc_html( $title ); if( $title_highlight ):?> <span><?php echo esc_html( $title_highlight ); ?></span><?php endif; ?></h2>
<h2><?php echo esc_html($title2); if( $title_highlight ):?> <span><?php echo esc_html( $title_highlight ); ?></span><?php endif; ?></h2>
</div>
</div>
<div class="title_p">
<div class="title_ptx">
<?php if($description): ?>
<p><?php echo esc_html( $description ); ?></p>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php
break;
default:
?>
<div class="<?php echo esc_attr( $extra_class ); ?> <?php echo esc_attr($custom_css_class); ?>">
<div class="section-title <?php if( $title_lr ){ echo $title_lr; }?>">
<?php if($title_sub){?>
<h5><?php echo esc_html($title_sub);?></h5>
<?php } ?>
<h2><?php echo esc_html( $title );?></h2>
<h2><?php echo esc_html($title2); if( $title_highlight ):?> <span><?php echo esc_html( $title_highlight ); ?></span><?php endif; ?></h2>
<?php if( $title_icon == 'yes' && !empty( $icon ) ){ ?>
<div class="em-icon">
<i class="<?php echo esc_attr( $icon ); ?>"></i>
</div>
<?php } ?>
<?php if( $show_bar == 'yes' ){ ?>
<div class="em-bar-main">
<div class="em-bar em-bar-big"></div>
</div>
<?php } ?>
<?php if($description): ?>
<p class=" text-alignm"><?php echo esc_html( $description ); ?></p>
<?php endif; ?>
<?php if( $show_img == 'yes' && !empty( $images ) ){ ?>
<div class="em-image">
<img src="<?php echo esc_url( $images[0] ); ?>" alt="insert image" />
</div>
<?php } ?>
</div>
</div>
<?php
break;
}
return ob_get_clean();
}
add_shortcode('em_section_title' ,'cyber_section_title_shortcode');
}