<?php

/** kirki custom heading function */

function newshit_register_kirki_custom_heading_control( $wp_customize ) {
	/**
	 * The custom control class
	 */
	class Kirki_Controls_Notice_Control extends WP_Customize_Control {
		public $type = 'cnote';
		public function render_content() { ?>
            <label>
                <span class="customize-control-title">
                    <h4 style="font-size: 16px; margin:0; color: #2816F8"><?php echo esc_html( $this->label ); ?></h4>
					<hr class="solid">
                    <?php if ( !empty( $this->description ) ): ?>
                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
                    <?php endif;
			?>
            </label>
            <?php
}
	}
}
add_action( 'customize_register', 'newshit_register_kirki_custom_heading_control' );

/**
 * Register our custom control with Kirki
 */
function newshit_kirki_custom_heading( $controls ) {
	$controls['cnote'] = 'Kirki_Controls_Notice_Control';
	return $controls;
}
add_action( 'kirki/control_types', 'newshit_kirki_custom_heading' );

/**
 * Custom JS Fucntion
 */

function newshit_custom_js() {
	$enable_js = get_theme_mod( 'enable_js_code', false );
	if ( true === $enable_js ) {
		$newshit_js_code = get_theme_mod( 'js_code_settings' );
		echo '
        <script type="text/javascript">
            jQuery(document).ready(function($) {
                ' . str_replace( '&gt;', '>', wp_kses_post( $newshit_js_code ) ) . '
            });
        </script>
        ';
	}
}
add_action( get_theme_mod( 'js_code_position', 'wp_footer' ), 'newshit_custom_js' );