From b62d464ebf55ac708fe8895d2003b1a441e1bc55 Mon Sep 17 00:00:00 2001 From: Adam Lipscore Date: Wed, 12 Nov 2025 07:43:15 +0100 Subject: [PATCH] Add support for custom attributes in initializer --- README.md | 3 +++ includes/class-lipscore-initializer.php | 12 +++++++++++- lipscore.php | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5e6142f..a9dbaf6 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ ## Changelog ## +### 0.6.4 ### +* Add support for custom attributes in initializer + ### 0.6.3 ### * Fixed notice in widget helper diff --git a/includes/class-lipscore-initializer.php b/includes/class-lipscore-initializer.php index 0896a47..bbf4e1e 100644 --- a/includes/class-lipscore-initializer.php +++ b/includes/class-lipscore-initializer.php @@ -11,9 +11,19 @@ public function add_script() { $api_key = Lipscore_Settings::api_key(); $assetsUrl = lipscore()->config->assets_url(); $locale = Lipscore_Settings::locale(); + $script_attributes = apply_filters('lipscore_script_attributes', array( + 'data-cfasync' => 'false', + 'type' => 'text/javascript' + )); + + $attrs_string = ''; + foreach ($script_attributes as $key => $value) { + $attrs_string .= sprintf('%s="%s" ', esc_attr($key), esc_attr($value)); + } + $attrs_string = trim ( $attrs_string ); echo " -