Skip to content

Instantly share code, notes, and snippets.

@kamalinfo
Created November 25, 2017 09:26
Show Gist options
  • Save kamalinfo/9f680d3e20cb2831449fb1e9a92f0e9e to your computer and use it in GitHub Desktop.
Save kamalinfo/9f680d3e20cb2831449fb1e9a92f0e9e to your computer and use it in GitHub Desktop.
<?php
/**
* =======================================================
* KC Shortcode Map
* =======================================================
*/
add_action('init', 'themename_team_sections'); // Call kc_add_map function ///
if(!function_exists('themename_team_sections')):
function themename_team_sections(){
if(function_exists('kc_add_map')): // if kingComposer is active
kc_add_map(
array(
'themename_team' => array( // <-- shortcode tag name
'name' => esc_html__('Team Section', 'themenameatr'),
'description' => esc_html__('Description Here', 'themenameatr'),
'icon' => 'fa-header',
'category' => themenameATR_SHORTCODE_CATEGORY,
'params' => array(
// .............................................
// ..... // Content TAB
// .............................................
'General' => array(
array(
'type' => 'attach_image',
'label' => esc_html__( 'Show Icon', 'themenameatr' ),
'name' => 'image',
'description' => esc_html__( 'Show the icon in the front side', 'themenameatr' )
),
array(
'name' => 'title',
'label' => esc_html__('Title','themenameatr'),
'type' => 'text',
'admin_label' => true,
'value' => 'Kathy Luis'
),
array(
'name' => 'subtitle',
'label' => esc_html__('Sub Title','themenameatr'),
'type' => 'text',
'value' => 'Officer'
),
array(
'name' => 'desc',
'label' => esc_html__( 'Description', 'themenameatr' ),
'type' => 'textarea',
'description' => esc_html__( 'Type short description for team member', 'themenameatr' ),
'value' => 'Lorem ipsupm dolor sit amet, conse ctetur adipisicing elit, sed do eiumthgtipsupm dolor sit amet conse',
),
array(
'name' => 'social_icons',
'label' => esc_html__( 'Social Icons', 'themenameatr' ),
'type' => 'group',
'description' => esc_html__( 'Select Social icon', 'themenameatr' ),
'options' => array('add_text' => esc_html__('Add New Icon','themenameatr') ),
'params' =>array(
array(
'name' => 'icons',
'type' => 'icon_picker',
'label' => esc_html__('Add Icon','themenameatr'),
'value' => 'zmdi-facebook',
),
array(
'name' => 'icon_link',
'type' => 'text',
'label' => esc_html__('Add Social Icon','themenameatr'),
),
)
),
array(
'name' => 'custom_css_class',
'label' => esc_html__('CSS Class','themenameatr'),
'description' => esc_html__('Custom css class for css customisation','themenameatr'),
'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__( 'Title Color', 'themenameatr' ),
'selector' => '+ .team-hover > h4'
),
array(
'property' => 'font-family',
'label' => esc_html__( 'Title Font Family', 'themenameatr' ),
'selector' => '+ .team-hover > h4'
),
array(
'property' => 'font-size',
'label' => esc_html__( 'Title Font Size', 'themenameatr' ),
'selector' => '+ .team-hover > h4'
),
array(
'property' => 'font-weight',
'label' => esc_html__( 'Title Font Weight','themenameatr' ),
'selector' => '+ .team-hover > h4'
),
array(
'property' => 'text-transform',
'label' => esc_html__( 'Title Text Transform', 'themenameatr' ),
'selector' => '+ .team-hover > h4'
),
array(
'property' => 'margin',
'label' => esc_html__( 'Title Margin', 'themenameatr' ),
'selector' => '+ .team-hover > h4'
),
),
///////
'subtitle' => array(
array(
'property' => 'color',
'label' => esc_html__( 'Subtitle Color', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'font-family',
'label' => esc_html__( 'Subtitle Font Family','themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'font-size',
'label' => esc_html__( 'Subtitle Font Size', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'text-transform',
'label' => esc_html__( 'Subtitle Text Transform', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'font-weight',
'label' => esc_html__( 'Subtitle Font Weight', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'margin',
'label' => esc_html__( 'Subtitle Margin', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
),
///////
'description' => array(
array(
'property' => 'color',
'label' => esc_html__( 'Description Color', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'font-family',
'label' => esc_html__( 'Font Family','themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'font-size',
'label' => esc_html__( 'Font Size', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'line-height',
'label' => esc_html__( 'Line Height', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
array(
'property' => 'margin',
'label' => esc_html__( 'Subtitle Margin', 'themenameatr' ),
'selector' => '+ .team-hover span'
),
),
///
'icon' => array(
array(
'property' => 'color',
'label' => esc_html__( 'Icon Color','themenameatr' ),
'selector' => '+ .team-links a'
),
array(
'property' => 'color',
'label' => esc_html__( 'Icon Hover Color','themenameatr' ),
'selector' => '+ .team-links a:hover'
),
array(
'property' => 'margin',
'label' => esc_html__( 'Icon Margin', 'themenameatr' ),
'selector' => '+ .team-links a '
),
),
///
'Background' =>array(
array(
'property' => 'background-color',
'label' => esc_html__( 'Background Hover Color', 'themenameatr' ),
'selector' => '+ .team-hover'
),
),
///
'box' => array(
array(
'property' => 'margin',
'label' => esc_html__( 'Section Margin','themenameatr' ),
'selector' => '+ .single-team ',
),
),
///
'Text align' => array(
array(
'property' => 'text-align',
'label' => esc_html__( 'Text Align', 'themenameatr' ),
'selector' => '+ .single-team'
),
),
)
) //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 team section
* =======================================================
*/
// [themenameatr_section_title title="" description="" custom_css_class=""]
if(!function_exists('themename_team_section_shortcode')){
function themename_team_section_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 );
$images = wp_get_attachment_image( $image, 'full');
?>
<div class="<?php echo esc_attr( $extra_class ); ?> <?php echo esc_attr($custom_css_class); ?>">
<div class="single-team">
<div class="team-image">
<?php echo $images; ?>
</div>
<div class="team-hover">
<?php if( $title ): ?>
<h4><?php echo esc_html( $title ); ?></h4>
<?php endif; if( $subtitle ): ?>
<span class="block">( <?php echo esc_html( $subtitle ); ?> )</span>
<?php endif; ?>
<?php echo wpautop( $desc ); ?>
<div class="team-links">
<?php
if( $social_icons ){
foreach( $social_icons as $icon ):
?>
<a href="<?php echo esc_url( $icon->icon_link ) ; ?>" title="facebook"><i class="<?php echo $icon->icons; ?>"></i></a>
<?php endforeach; } ?>
</div>
</div>
</div>
</div>
<?php
return ob_get_clean();
}
add_shortcode('themename_team' ,'themename_team_section_shortcode');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment