/** * Format the script in a way that will be compatible with WordPress. */ public function enqueue_script() { if (!self::$script_added && '' != self::$tooltip_script) { self::$script_added = true; echo '<script>jQuery(document).ready(function($) { "use strict"; ' . wp_kses_post(self::$tooltip_script) . '});</script>'; } }
/** * Create the settings and controls from the $fields array and register them. * * @var object The WordPress Customizer object * @return void */ public function add_fields() { global $wp_customize; foreach (Kirki::$fields as $args) { if (isset($args['type']) && 'background' === $args['type']) { continue; } // Create the settings. new Kirki_Settings($args); // Check if we're on the customizer. // If we are, then we will create the controls, add the scripts needed for the customizer // and any other tweaks that this field may require. if ($wp_customize) { // Create the control. new Kirki_Control($args); // Create the scripts for tooltips. Kirki_Scripts_Tooltips::generate_script($args); } } }