-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontend.php
35 lines (29 loc) · 1.17 KB
/
frontend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Add link to the Manifest in the theme.
*/
add_action('wp_enqueue_scripts', 'zw_webapp_enqueue_scripts');
add_action('wp_head', 'zw_webapp_head_tags');
function zw_webapp_enqueue_scripts()
{
$webapp_settings = get_option('zw_webapp_settings');
if (!empty($webapp_settings['progressier_id'])) {
$base_url = 'https://progressier.app/' . $webapp_settings['progressier_id'];
// phpcs:disable WordPress.WP.EnqueuedResourceParameters.NoExplicitVersion
wp_enqueue_script('progressier', $base_url . '/script.js', [], false, ['strategy' => 'defer']);
// phpcs:enable
}
}
function zw_webapp_head_tags()
{
$webapp_settings = get_option('zw_webapp_settings');
if (!empty($webapp_settings['progressier_id'])) {
$base_url = 'https://progressier.app/' . $webapp_settings['progressier_id'];
echo '<link rel="manifest" href="' . esc_url($base_url . '/progressier.json') . '"/>' . "\n";
}
// Check for required settings
if (!empty($webapp_settings['theme_color'])) {
$theme_color = esc_attr($webapp_settings['theme_color']);
echo '<meta name="theme-color" content="' . $theme_color . '"/>' . "\n";
}
}