Created
November 25, 2017 09:37
-
-
Save kamalinfo/7b897b5130f910141f135e9b91361c3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ======================================================= | |
* KC Shortcode Map | |
* ======================================================= | |
*/ | |
add_action('init', 'themename_upcomming_section'); // Call kc_add_map function /// | |
if(!function_exists('themename_upcomming_section')): | |
function themename_upcomming_section(){ | |
if(function_exists('kc_add_map')): // if kingComposer is active | |
kc_add_map( | |
array( | |
'themename_upcomming' => array( // <-- shortcode tag name | |
'name' => esc_html__('Upcomming Products', 'themename'), | |
'description' => esc_html__('Description Here', 'themename'), | |
'icon' => 'fa-header', | |
'category' => themename_SHORTCODE_CATEGORY, | |
'params' => array( | |
// ............................................. | |
// ..... // Content TAB | |
// ............................................. | |
'General' => array( | |
array( | |
'type' => 'attach_image', | |
'label' => esc_html__( 'Image', 'themename' ), | |
'name' => 'image', | |
'description' => esc_html__( 'Select Image', 'themename' ), | |
), | |
array( | |
'type' => 'text', | |
'label' => esc_html__( 'Title', 'themename' ), | |
'name' => 'title', | |
'description' => esc_html__( 'enter title', 'themename' ), | |
'value' => 'themename Style 2017', | |
), | |
array( | |
'type' => 'text', | |
'label' => esc_html__( 'Price', 'themename' ), | |
'name' => 'price', | |
'description' => esc_html__( 'enter price', 'themename' ), | |
'value' => '$ 200.00', | |
), | |
array( | |
'type' => 'link', | |
'label' => esc_html__( 'Link', 'themename' ), | |
'name' => 'product_link', | |
'description' => esc_html__( 'enter link', 'themename' ), | |
), | |
array( | |
'name' => 'countdown_show', | |
'label' => esc_html__('Countdown','themename'), | |
'type' => 'toggle', | |
'value' => 'yes', | |
'description' => 'Control Countdown.', | |
), | |
array( | |
'type' => 'text', | |
'label' => esc_html__( 'Day', 'themename' ), | |
'name' => 'cday', | |
'value' => '07', | |
'description' => esc_html__( 'Day', 'themename' ), | |
'relation' => array( | |
'parent' => 'countdown_show', | |
'show_when' => 'yes' | |
) | |
), | |
array( | |
'type' => 'text', | |
'label' => esc_html__( 'Month', 'themename' ), | |
'name' => 'cmonth', | |
'value' => '07', | |
'description' => esc_html__( 'Month', 'themename' ), | |
'relation' => array( | |
'parent' => 'countdown_show', | |
'show_when' => 'yes' | |
) | |
), | |
array( | |
'type' => 'text', | |
'label' => esc_html__( 'Year', 'themename' ), | |
'name' => 'cyear', | |
'value' => '2017', | |
'description' => esc_html__( 'Year', 'themename' ), | |
'relation' => array( | |
'parent' => 'countdown_show', | |
'show_when' => 'yes' | |
) | |
), | |
array( | |
'name' => 'custom_css_class', | |
'label' => esc_html__('CSS Class','themename'), | |
'description' => esc_html__('Custom css class for css customisation','themename'), | |
'type' => 'text' | |
), | |
), // content | |
// ............................................. | |
// ..... // Styling | |
// ............................................. | |
'styling' => array( | |
array( | |
'name' => 'custom_css', | |
'type' => 'css', | |
'options' => array( | |
array( | |
'screens' => 'any,1024,999,767,479', | |
/// | |
'Title' => array( | |
array( | |
'property' => 'color', | |
'label' => esc_html__( 'Color', 'themename' ), | |
'selector' => '+ .post-title a' | |
), | |
array( | |
'property' => 'color', | |
'label' => esc_html__( 'Hover Color', 'themename' ), | |
'selector' => '+ .post-title a:hover' | |
), | |
array( | |
'property' => 'font-family', | |
'label' => esc_html__( 'Font Family', 'themename' ), | |
'selector' => '+ .post-title a' | |
), | |
array( | |
'property' => 'font-size', | |
'label' => esc_html__( 'Font Size', 'themename' ), | |
'selector' => '+ .post-title a' | |
), | |
array( | |
'property' => 'font-weight', | |
'label' => esc_html__( 'Font Weight','themename' ), | |
'selector' => '+ .post-title a' | |
), | |
array( | |
'property' => 'text-transform', | |
'label' => esc_html__( 'Text Transform', 'themename' ), | |
'selector' => '+ .post-title a' | |
), | |
), | |
/// | |
'Price' => array( | |
array( | |
'property' => 'color', | |
'label' => esc_html__( ' Color', 'themename' ), | |
'selector' => '+ .comming-pro-price' | |
), | |
array( | |
'property' => 'font-family', | |
'label' => esc_html__( 'Font Family', 'themename' ), | |
'selector' => '+ .comming-pro-price' | |
), | |
array( | |
'property' => 'font-size', | |
'label' => esc_html__( 'Font Size', 'themename' ), | |
'selector' => '+ .comming-pro-price' | |
), | |
array( | |
'property' => 'font-weight', | |
'label' => esc_html__( 'Font Weight','themename' ), | |
'selector' => '+ .comming-pro-price' | |
), | |
array( | |
'property' => 'text-transform', | |
'label' => esc_html__( ' Text Transform', 'themename' ), | |
'selector' => '+ .comming-pro-price' | |
), | |
), | |
/// | |
'Time count' => array( | |
array( | |
'property' => 'color', | |
'label' => esc_html__('Text Color','themename'), | |
'selector' => '+ .count-down p' | |
), | |
array( | |
'property' => 'font-size', | |
'label' => esc_html__('Font Size','themename'), | |
'selector' => '+ .count-down p' | |
), | |
array( | |
'property' => 'font-family', | |
'label' => esc_html__('Font Family','themename'), | |
'selector' => '+ .count-down p' | |
), | |
array( | |
'property' => 'font-weight', | |
'label' => esc_html__('Font Weight','themename'), | |
'selector' => '+ .count-down p' | |
), | |
array( | |
'property' => 'text-transform', | |
'label' => esc_html__('Text Transform','themename'), | |
'selector' => '+ .count-down p' | |
), | |
array( | |
'property' => 'border-color', | |
'label' => esc_html__('Border Color', 'themename'), | |
'selector' => '+ .time-count' | |
), | |
), | |
/// | |
'Background' => array( | |
array( | |
'property' => 'background-color', | |
'label' => esc_html__('Background Hover', 'themename'), | |
'selector' => '+ .up-comming-product' | |
), | |
), | |
/// | |
'Box' => array( | |
array( | |
'property' => 'margin', | |
'label' => esc_html__( 'Section Margin','themename' ), | |
'selector' => '+ .up-comming-product', | |
), | |
), | |
) | |
) //End of options | |
) | |
), //End of styling | |
'animate' => array( | |
array( | |
'name' => 'animate', | |
'type' => 'animate' | |
) | |
), //End of animate | |
// ............................................. | |
// ............................................. | |
// ............................................. | |
///////////////////////////////////////////////////////// | |
)// Params | |
)// end shortcode key | |
)// first array | |
); // End add map | |
endif; | |
} | |
endif; | |
/* | |
* ======================================================= | |
* Register Shortcode | |
* ======================================================= | |
*/ | |
//[themename_feature icon="" image="" title="" count="" custom_css_class=""] | |
if(!function_exists('themename_upcomming_shortcode')){ | |
function themename_upcomming_shortcode($atts,$content){ | |
ob_start(); | |
extract( $atts ); | |
//custom class | |
$wrap_class = apply_filters( 'kc-el-class', $atts ); | |
if( !empty( $custom_class ) ): | |
$wrap_class[] = $custom_class; | |
endif; | |
$extra_class = implode( ' ', $wrap_class ); | |
$image = wp_get_attachment_image( $image, 'full'); | |
$countdate = $cyear.'/'.$cmonth.'/'.$cday; | |
if(!empty($product_link)){ | |
$link_attr = explode('|', $product_link); | |
if(!empty($link_attr[0])){ | |
$link_url = $link_attr[0]; | |
}else{ | |
$link_url = '#'; | |
} | |
}else{ | |
$link_url = '#'; | |
} | |
?> | |
<div class="<?php echo esc_attr( $extra_class ); ?> <?php echo esc_attr( $custom_css_class ); ?>"> | |
<div class="up-comming-product"> | |
<div class="up-comming-img"> | |
<a href="<?php echo $link_url; ?>"><?php echo $image; ?></a> | |
</div> | |
<div class="up-comming-info text-center"> | |
<div class="up-comming-brief"> | |
<?php if( $title ): ?> | |
<h4 class="post-title"><a href="<?php echo $link_url; ?>"><?php echo esc_html( $title ); ?></a></h4> | |
<?php endif; if( $price ): ?> | |
<h4 class="comming-pro-price"><?php echo esc_html( $price ); ?></h4> | |
<?php endif; ?> | |
</div> | |
<?php if($countdown_show=='yes'): ?> | |
<div class="count-down"> | |
<div data-countdown="<?php echo esc_attr( $countdate ); ?>"></div> | |
</div> | |
<?php endif; ?> | |
</div> | |
</div> | |
</div> | |
<?php | |
return ob_get_clean(); | |
} | |
add_shortcode('themename_upcomming' ,'themename_upcomming_shortcode'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment