This works on a per-field basis.
Once created, the script is added to the $tooltip_script property.
public static generate_script ( array $args = [] ) : void | ||
$args | array | The field definition. |
return | void |
/** * 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); } } }