/
header.php
143 lines (116 loc) · 4.1 KB
/
header.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/**
* The header for our theme
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package uds-wordpress-theme
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
$c_options = array();
$asu_hub_analytics = 'enabled';
$site_gcs_ownership_verification_id = '';
$site_gtm_container_id = '';
$site_ga_tracking_id = '';
$hotjar_site_id = '';
//$hide_asu_header = get_field('hide_asu_header', 'options');
// retrieve settings from the theme mods entry in the options database table.
$c_options = get_theme_mods();
// Is navigation menu enabled?
// Do we have an asu_hub_analytics setting?
if (!empty($c_options['asu_hub_analytics'])) {
$asu_hub_analytics = $c_options['asu_hub_analytics'];
}
// Do we have a site_gcs_ownership_verification_id setting?
if (!empty($c_options['site_gcs_ownership_verification_id'])) {
$site_gcs_ownership_verification_id = $c_options['site_gcs_ownership_verification_id'];
}
// Do we have a site_gtm_container_id setting?
if (!empty($c_options['site_gtm_container_id'])) {
$site_gtm_container_id = $c_options['site_gtm_container_id'];
}
// Do we have a site_ga_tracking_id setting?
if (!empty($c_options['site_ga_tracking_id'])) {
$site_ga_tracking_id = $c_options['site_ga_tracking_id'];
}
// Do we have an hotjar_site_id setting?
if (!empty($c_options['hotjar_site_id'])) {
$hotjar_site_id = $c_options['hotjar_site_id'];
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
<?php
if (is_user_logged_in() && !is_customize_preview()) {
// shift page content below the WP Admin toolbar.
?>
<style type="text/css" media="screen">
#wpadminbar {
z-index: 999999 !important;
}
</style>
<?php
}
// ASU Hub Analytics.
if (!empty($asu_hub_analytics) && 'enabled' === $asu_hub_analytics) {
include get_template_directory() . '/inc/analytics/asu-gtm-analytics-tracking-code.php';
}
// Lavidge Adwords tracking code.
if (!function_exists('uds_wp_include_lavidge_script')) {
/**
* Include Lavidge Adword script.
*/
function uds_wp_include_lavidge_script()
{
$lav_c_options = array();
$lav_c_options = get_theme_mods();
// Do we have an asu_hub_analytics setting?
if (!empty($lav_c_options['asu_hub_analytics'])) {
$lav_asu_hub_analytics = $lav_c_options['asu_hub_analytics'];
}
// If the setting is "enabled", turn on the tracking code.
if (!empty($lav_asu_hub_analytics) && 'enabled' === $lav_asu_hub_analytics) {
include get_template_directory() . '/inc/analytics/asu-lavidge-analytics-tracking-code.php';
}
}
}
add_action('include_lavidge_script', 'uds_wp_include_lavidge_script', 10, 2);
do_action('include_lavidge_script');
// Google Search Console Ownership Verification.
// Only add the Ownership Verification meta tag on the site homepage
if (!empty($site_gcs_ownership_verification_id) && is_front_page()) {
echo '<meta name="google-site-verification" content="' . esc_html(trim($site_gcs_ownership_verification_id)) . '" />';
}
// Site Google Tag Manager.
if (!empty($site_gtm_container_id)) {
include get_template_directory() . '/inc/analytics/google-tag-manager-tracking-code.php';
}
// Site Google Analytics.
if (!empty($site_ga_tracking_id)) {
include get_template_directory() . '/inc/analytics/google-analytics-tracking-code.php';
}
// Hotjar Analytics.
if (!empty($hotjar_site_id)) {
include get_template_directory() . '/inc/analytics/hotjar-tracking-code.php';
}
?>
</head>
<body <?php body_class(); ?> <?php uds_wp_body_attributes(); ?> id="back_to_top">
<?php
do_action('wp_body_open');
// Site Google Tag Manager (noscript).
if (!empty($site_gtm_container_id)) {
include get_template_directory() . '/inc/analytics/google-tag-manager-noscript-code.php';
}
if (is_user_logged_in()) {
$current_user = wp_get_current_user();
}
?>
<div id="header-container"></div>
<?php do_action('uds_wp_after_global_header'); ?>