-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
116 lines (101 loc) · 5.85 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
<?php
/**
* The header for our theme
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package proton
*/
$proton_custom_logo_id = get_theme_mod( 'custom_logo' );
$proton_image = wp_get_attachment_image( $proton_custom_logo_id , 'full', false, array( 'class' => 'site-logo' ) );
$proton_blog_name = get_bloginfo( 'name' );
$proton_blog_description = get_bloginfo( 'description' );
$classes = array();
//add dark mode class if enabled
if( get_theme_mod( 'proton_color_scheme_toggle') === 'dark' ){
array_push($classes, 'dark-mode');
}
//add auto class if enabled
if( get_theme_mod( 'proton_color_scheme_toggle') === 'auto' ){
array_push($classes, 'auto-color');
}
//join classes with a string
$classes = implode(' ', $classes);
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="<?php echo $classes; ?>">
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php wp_head(); ?>
</head>
<body <?php body_class( 'is-head-left-logo has-cover' ); ?>>
<?php wp_body_open(); ?>
<div class="viewport">
<header id="gh-head" class="gh-head outer">
<div class="gh-head-inner inner">
<div class="gh-head-brand">
<a class="gh-head-logo" href="<?php echo esc_url( home_url() ); ?>">
<?php if( has_custom_logo() ){ ?>
<?php echo $proton_image; ?>
<?php }else{ ?>
<?php echo esc_html( $proton_blog_name ); ?>
<?php } ?>
</a>
<button class="search-button gh-icon-btn" data-ghost-search>
<?php get_template_part('template-parts/icons/search'); ?>
<span class="screen-reader-text">Search</span>
</button>
<button class="gh-burger">
<span class="screen-reader-text">Mobile Menu Toggle</span>
</button>
</div>
<nav class="gh-head-menu">
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'menu_class' => 'nav',
'depth' => 1
)
);
?>
</nav>
<div class="gh-head-actions">
<div class="gh-social">
<?php if ( get_theme_mod( 'proton_social_facebook') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_facebook') ); ?>" title="<?php esc_attr_e( 'Facebook', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/facebook'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_twitter') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_twitter') ); ?>" title="<?php esc_attr_e( 'Twitter', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/twitter'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_instagram') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_instagram') ); ?>" title="<?php esc_attr_e( 'Instagram', 'proton' ); ?>" target="_blank" rel="menoopener"><?php get_template_part('template-parts/icons/instagram'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_youtube') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_youtube') ); ?>" title="<?php esc_attr_e( 'YouTube', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/youtube'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_github') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_github') ); ?>" title="<?php esc_attr_e( 'GitHub', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/github'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_mastodon') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_mastodon') ); ?>" title="<?php esc_attr_e( 'Mastodon', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/mastodon'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_bluesky') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_bluesky') ); ?>" title="<?php esc_attr_e( 'Bluesky', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/bluesky'); ?></a>
<?php } ?>
<?php if ( get_theme_mod( 'proton_social_linkedin') ){ ?>
<a class="gh-social-link" href="<?php echo esc_url( get_theme_mod( 'proton_social_linkedin') ); ?>" title="<?php esc_attr_e( 'LinkedIn', 'proton' ); ?>" target="_blank" rel="me noopener"><?php get_template_part('template-parts/icons/linkedin'); ?></a>
<?php } ?>
</div>
<button class="search-button gh-icon-btn">
<?php get_template_part('template-parts/icons/search'); ?>
<span class="screen-reader-text">Search</span>
</button>
</div>
</div>
</header>