processed ) { foreach ( $configs as $config_id => $args ) { if ( true === $args['disable_output'] ) { continue; } $styles = self::loop_controls( $config_id ); if ( ! empty( $styles ) ) { wp_enqueue_style( 'kirki-styles-' . $config_id, trailingslashit( Kirki::$url ) . 'assets/css/kirki-styles.css', null, null ); wp_add_inline_style( 'kirki-styles-' . $config_id, $styles ); } } $this->processed = true; } } // public function ajax_dynamic_css() { // require( Kirki::$path . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'dynamic-css.php' ); // exit; // } // // public function frontend_styles() { // wp_enqueue_style( 'kirki-styles-php', admin_url( 'admin-ajax.php' ) . '?action=kirki_dynamic_css', null, null ); // } /** * loop through all fields and create an array of style definitions */ public static function loop_controls( $config_id ) { // Get an instance of the Kirki_Styles_Output_CSS class. // This will make sure google fonts and backup fonts are loaded. Kirki_Styles_Output_CSS::get_instance(); $fields = Kirki::$fields; $css = array(); // Early exit if no fields are found. if ( empty( $fields ) ) { return; } foreach ( $fields as $field ) { // Only process fields that belong to $config_id if ( $config_id != $field['kirki_config'] ) { continue; } // Only continue if $field['output'] is set if ( isset( $field['output'] ) && ! empty( $field['output'] ) && 'background' != $field['type'] ) { if ( function_exists( 'array_replace_recursive' ) ) { $css = array_replace_recursive( $css, Kirki_Styles_Output_CSS::css( $field ) ); } else { $css = Kirki_Helper::array_replace_recursive( $css, Kirki_Styles_Output_CSS::css( $field ) ); } } } if ( is_array( $css ) ) { return Kirki_Styles_Output_CSS::styles_parse( Kirki_Styles_Output_CSS::add_prefixes( $css ) ); } return; } } }