182 lines
5.8 KiB
PHP
182 lines
5.8 KiB
PHP
<?php
|
|
/*
|
|
* Team Section
|
|
* Author: themetags
|
|
* Author URI: http://webitkurigram.com
|
|
* Version: 1.0
|
|
* ======================================================
|
|
*/
|
|
|
|
/**
|
|
* =======================================================
|
|
* KC Shortcode Map
|
|
* =======================================================
|
|
*/
|
|
|
|
add_action('init', 'cyber_custom_button');
|
|
if(!function_exists('cyber_custom_button')):
|
|
function cyber_custom_button(){
|
|
if(function_exists('kc_add_map')):
|
|
kc_add_map(
|
|
array(
|
|
'cyber_custom_button' => array(
|
|
'name' => __( 'Cyber Custom Button', 'cyber' ),
|
|
'title' => 'Button Settings',
|
|
'icon' => 'kc-icon-feature-box',
|
|
'category' => 'cyber',
|
|
'wrapper_class' => 'clearfix',
|
|
'description' => __( 'Display Button style.', 'cyber' ),
|
|
'params' => array(
|
|
'general' => array(
|
|
|
|
array(
|
|
'name' => 'button_text',
|
|
'label' => __( 'Text Button', 'cyber' ),
|
|
'type' => 'text',
|
|
'value' => __( 'Read More', 'cyber' )
|
|
),
|
|
array(
|
|
'name' => 'button_link',
|
|
'label' => __( 'Link Button', 'cyber' ),
|
|
'type' => 'link',
|
|
'value' => '#'
|
|
),
|
|
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',
|
|
'3' => EM40_EXTENSION_URI . 'asstes/images/blog/layout3.jpg',
|
|
),
|
|
'description' => __( 'Select Your Button 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",
|
|
'Button' => array(
|
|
array('property' => 'color', 'label' => 'Color', 'selector' => '.cyber-button a'),
|
|
array('property' => 'color', 'label' => 'Hover Color', 'selector' => '+:hover .cyber-button a'),
|
|
array('property' => 'background-color', 'label' => 'BG Color', 'selector' => '.cyber-button a'),
|
|
array('property' => 'background-color', 'label' => 'BG Color Hover', 'selector' => '+:hover .cyber-button a'),
|
|
array('property' => 'border', 'label' => 'Border', 'selector' => '.cyber-button a'),
|
|
array('property' => 'border-color', 'label' => 'Hover Border', 'selector' => '+:hover .cyber-button a'),
|
|
array('property' => 'border-radius', 'label' => 'Border Radius', 'selector' => '.cyber-button a'),
|
|
array('property' => 'font-size', 'label' => 'Font Size', 'selector' => '.cyber-button a'),
|
|
array('property' => 'height', 'label' => 'Height', 'selector' => '.cyber-button a'),
|
|
array('property' => 'width', 'label' => 'Width', 'selector' => '.cyber-button a'),
|
|
array('property' => 'line-height', 'label' => 'Line Height', 'selector' => '.cyber-button a'),
|
|
array('property' => 'padding', 'label' => 'Padding', 'selector' => '.cyber-button a'),
|
|
array('property' => 'margin', 'label' => 'Margin', 'selector' => '.cyber-button a')
|
|
),
|
|
'Box' => array(
|
|
array('property' => 'text-align', 'label' => 'Box Text Align'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow', 'selector' => '+.cyber-custom-buttons'),
|
|
array('property' => 'box-shadow', 'label' => 'Box Shadow Hover', 'selector' => '+.cyber-custom-buttons:hover'),
|
|
array('property' => 'margin', 'label' => 'Margin'),
|
|
array('property' => 'padding', 'label' => 'Padding')
|
|
)
|
|
|
|
)
|
|
)
|
|
)
|
|
),
|
|
'animate' => array(
|
|
array(
|
|
'name' => 'animate',
|
|
'type' => 'animate'
|
|
)
|
|
),
|
|
)
|
|
),
|
|
)// first array
|
|
); // End add map
|
|
endif;
|
|
}
|
|
endif;
|
|
|
|
/**
|
|
* =======================================================
|
|
* Register Shortcode team section
|
|
* =======================================================
|
|
*/
|
|
// [cyber-icon-box_box title="" desc="" icon=""]
|
|
if(!function_exists('cyber_custom_button_shortcode')){
|
|
function cyber_custom_button_shortcode($atts,$content){
|
|
ob_start();
|
|
$cyber_custom_button = shortcode_atts(array(
|
|
'button_text' => '',
|
|
'button_link' => '',
|
|
'layout' => '1',
|
|
'custom_css' => '',
|
|
'custom_class' => '',
|
|
),$atts);
|
|
extract( $cyber_custom_button );
|
|
//custom class
|
|
$wrap_class = apply_filters( 'kc-el-class', $atts );
|
|
if( !empty( $custom_class ) ):
|
|
$wrap_class[] = $custom_class;
|
|
endif;
|
|
$extra_class = implode( ' ', $wrap_class );
|
|
|
|
$data_button="";
|
|
$size_array = array('full', 'medium', 'large', 'thumbnail');
|
|
|
|
|
|
if ( !empty( $button_link ) ) {
|
|
$button_link_text = explode( '|', $button_link );
|
|
$button_link = $button_link_text[0];
|
|
}
|
|
|
|
if( empty($button_text) )
|
|
$button_text = __( '', 'cyber' );
|
|
|
|
$data_button .= '<div class="cyber-button">';
|
|
$data_button .= '<a href="'. $button_link .'">'. $button_text .'<i class="fa fa-angle-right"></i></a>';
|
|
$data_button .= '</div>';
|
|
|
|
|
|
switch($layout){
|
|
case'3':
|
|
?>
|
|
<div class="cyber-custom-buttons three <?php echo esc_attr( $extra_class ); ?>">
|
|
<?php echo $data_button; ?>
|
|
</div>
|
|
<?php
|
|
break;
|
|
case'2':
|
|
?>
|
|
<div class="cyber-custom-buttons two <?php echo esc_attr( $extra_class ); ?>">
|
|
<?php echo $data_button; ?>
|
|
</div>
|
|
<?php
|
|
break;
|
|
default:
|
|
?>
|
|
<div class="cyber-custom-buttons one <?php echo esc_attr( $extra_class ); ?>">
|
|
<?php echo $data_button; ?>
|
|
</div>
|
|
<?php
|
|
break;
|
|
}
|
|
|
|
return ob_get_clean();
|
|
}
|
|
add_shortcode('cyber_custom_button' ,'cyber_custom_button_shortcode');
|
|
}
|