Skip to content

Commit e49a1f2

Browse files
authored
add JS to head
1 parent 6e85d92 commit e49a1f2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cookiechimp.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ function cookiechimp_settings_page() {
8181
}
8282

8383
// Hook to insert the CookieChimp JS in the head section with high priority
84-
add_action('wp_enqueue_scripts', 'enqueue_cookiechimp_js', 1);
84+
add_action('wp_head', 'insert_cookiechimp_js', 1);
8585

8686
/**
87-
* Enqueue the CookieChimp JS into the head section of the site.
87+
* Output the CookieChimp JS directly into the head section.
8888
*/
89-
function enqueue_cookiechimp_js() {
89+
function insert_cookiechimp_js() {
9090
$cookiechimp_account_id = get_option('cookiechimp_account_id');
9191
if ($cookiechimp_account_id) {
92-
wp_enqueue_script('cookiechimp', 'https://cookiechimp.com/widget/' . esc_attr($cookiechimp_account_id) . '.js', array(), '1.0', false);
92+
echo '<script src="https://cookiechimp.com/widget/' . esc_attr($cookiechimp_account_id) . '.js"></script>';
9393
}
9494
}
9595

@@ -125,4 +125,4 @@ function cookiechimp_settings_link($links) {
125125
array_unshift($links, $settings_link);
126126
return $links;
127127
}
128-
?>
128+
?>

0 commit comments

Comments
 (0)