Custom Section With KingComposer

Posted on

Paste below code to functions.php

if (function_exists('kc_add_map')){
	$kc->add_map(
		array(
			'bpt_element' => array(
				'name'        => 'Your Parent Element ID',
				'description' => __('Description', 'Your Theme Text Domain'),
				'icon'        => 'icon-bpt',
				'category'    => 'BusinessLine',
				'params'      => array(
					/*
					*Sub Section
					*/
					'general' => array(
						array(
							'name'  => 'Your_Element_ID',
							'label' => __('Description', 'Your Theme Text Domain'),
							'type'  => 'text',
						),
					),
					'styling' => array(
						/*
						*Custom css option
						*/
						array(
							'name'    => 'css_custom',
							'type'    => 'css',
						)
					),

				)
			)
		)
	);
	
	/**
	 * Shortcode output
	 */
	 
	add_shortcode( 'bpt_element', 'bpt_name_Shortcode' );
	 
	function bpt_name_Shortcode( $atts ){
		extract(shortcode_atts( array(
			'Your_Element_ID' => ''
		), $atts ));
		// add kingcomposer custom Class
		$master_class = apply_filters( 'kc-el-class', $atts );
		$inline_class = implode( ' ', $master_class );

		return '<div class="'.$inline_class.'">'.$Your_Element_ID.'</div>';
	}
}

*Above code is pretty much self explanatory

add a comment

Leave a Reply

Your email address will not be published.

*