-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.php
120 lines (95 loc) · 3.95 KB
/
base.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
<?php
/**
* The base template file.
*
* This is the theme wrapper template file
* The entire site structure is included here: header, hero, content, and footer
* If you don't want/need the hero sections, delete the calls to get_template_part('template-parts/hero') and delete hero.php
*
* @package baseinstall
*/
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<?php // GTM head script
$gtmHeaderScript = '';
$options = get_option('baseinstall_options');
// Check if $options is an array and the specific key exists
if (is_array($options) && isset($options['baseinstall-gtm-header'])) {
$gtmHeaderScript = $options['baseinstall-gtm-header'];
}
if ($gtmHeaderScript) {
echo $gtmHeaderScript;
}
?>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php wp_head(); ?>
<?php // Third-Party tracker body script
$options = get_option('baseinstall_options');
if (is_array($options) && isset($options['baseinstall-thirdparty-script-header'])) {
$thirdPartyHeaderScripts = $options['baseinstall-thirdparty-script-header'];
echo $thirdPartyHeaderScripts;
}
?>
<?php // Schema scripts, set in theme-options.php and updated in Appearance -> Theme Options
if (is_front_page()) {
if (is_array($options) && isset($options['baseinstall-homepage-schema-scripts'])) {
$schemaHomepageScripts = $options['baseinstall-homepage-schema-scripts'];
echo $schemaHomepageScripts;
}
} else {
if (is_array($options) && isset($options['baseinstall-global-schema-scripts'])) {
$schemaGlobalScripts = $options['baseinstall-global-schema-scripts'];
echo $schemaGlobalScripts;
}
}
?>
<?php
/* CRITICAL CSS
* Importing critical CSS file content, then loading deferred stylesheet with noscript fallback */ ?>
<style type="text/css"><?php echo file_get_contents(get_template_directory_uri() . '/assets/dist/css/critical.css');?></style>
<link rel="preload" href="<?php echo get_template_directory_uri() . '/assets/dist/css/styles.css'; ?>" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="<?php echo get_template_directory_uri() . '/assets/dist/css/styles.css'; ?>"></noscript>
<?php /* END CRITICAL CSS */ ?>
</head>
<body <?php body_class('site__wrap'); ?>>
<?php // GTM body script
$options = get_option('baseinstall_options');
if (is_array($options) && isset($options['baseinstall-gtm-body'])) {
$gtmBodyScript = $options['baseinstall-gtm-body'];
echo $gtmBodyScript;
}
?>
<?php // Third-Party tracker body script
$options = get_option('baseinstall_options');
if (is_array($options) && isset($options['baseinstall-thirdparty-script-body'])) {
$thirdPartyBodyScripts = $options['baseinstall-thirdparty-script-body'];
echo $thirdPartyBodyScripts;
}
?>
<div id="page" class="site">
<h1 class="screen-reader-text"><?php
if ( have_posts() ) :
echo get_bloginfo( 'name' ) .' - '. get_the_title();
else :
echo get_bloginfo( 'name' ) .' - No results';
endif; ?></h1>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'baseinstall' ); ?></a>
<?php get_header( baseinstall_template_base() ); ?>
<div id="content-wrap" class="siteContent__wrap">
<div id="content" class="siteContent">
<div id="primary" class="contentArea">
<main id="main" class="siteMain">
<?php include baseinstall_template_path(); ?>
</main>
</div>
</div>
</div>
<?php get_footer( baseinstall_template_base() ); ?>
</div>
<?php wp_footer(); ?>
</body>
</html>