-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
executable file
·134 lines (99 loc) · 4.99 KB
/
header.php
File metadata and controls
executable file
·134 lines (99 loc) · 4.99 KB
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
<?php
/**
* The template for displaying the header.
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js" data-school="default">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<?php wp_head(); ?>
<link rel="stylesheet" type="text/css" href="https://cloud.typography.com/7861216/7459392/css/fonts.css" />
<link rel="shortcut icon" href="<?php echo get_stylesheet_directory_uri(); ?>/favicon.png" />
</head>
<body <?php body_class(); ?>>
<a href="#content" class="screen-reader-text">Skip to main content</a>
<div id="page">
<?php \CCL\Helpers\get_component( 'user-nav' ); ?>
<?php \CCL\Helpers\get_component( 'quick-nav' ); ?>
<header id="masthead" class="ccl-c-masthead ccl-u-mb-1" role="banner">
<div class="ccl-l-container">
<?php $aria_headers = is_front_page() ? 'role="heading" aria-level="1"' : ''; ?>
<div class="ccl-c-masthead__brand">
<a href="<?php echo get_home_url(); ?>" <?php echo $aria_headers; ?> >
<span class="ccl-b-logo ccl-is-vert ccl-u-hide-md" aria-hidden="true"></span>
<span class="ccl-b-logo ccl-is-horz ccl-u-show-lg" aria-hidden="true"></span>
<span class="ccl-u-display-none" ><?php echo bloginfo( 'name' ); ?></span>
</a>
</div>
<div class="ccl-c-masthead__nav">
<?php $locations = get_nav_menu_locations(); ?>
<?php if ( has_nav_menu( 'header_1' ) ) {
echo \CCL\Helpers\header_menu( $locations[ 'header_1' ], 'ccl-is-primary ccl-c-masthead__nav-item' );
} else {
echo '<div class="ccl-u-mt-1"><a href="' . admin_url( 'nav-menus.php' ) . '" class="ccl-b-btn ccl-is-small">Add a primary header menu</a></div>';
} ?>
<?php if ( has_nav_menu( 'header_2' ) ) {
echo \CCL\Helpers\header_menu( $locations[ 'header_2' ], 'ccl-is-secondary ccl-c-masthead__nav-item' );
} else {
echo '<div class="ccl-u-mt-1"><a href="' . admin_url( 'nav-menus.php' ) . '" class="ccl-b-btn ccl-is-small">Add a secondary header menu</a></div>';
} ?>
<?php
// @todo Sort out how to handle "Notices"
// @todo Cache the build header functions?
$events = \CCL\Helpers\get_header_events();
$hours = \CCL\Helpers\get_library_hours();
$notices = \CCL\Helpers\get_header_notices();
?>
<ul class="ccl-c-masthead__status ccl-c-masthead__nav-item">
<?php if ( $hours ) : ?>
<li>
<span class="ccl-h5"><span class="ccl-b-icon clock" aria-hidden="true"></span> Today's hours</span>
<ul class="ccl-c-masthead__hours">
<?php foreach($hours->locations as $location): ?>
<?php if( empty( $location->rendered ) || $location->rendered == '' ) continue; ?>
<li class="ccl-u-font-size-sm"><span><?php echo $location->name; ?></span> <span><?php echo $location->rendered; ?></span></li>
<?php endforeach; ?>
<li><a class="ccl-u-font-size-sm ccl-c-masthead__more-hours" href="<?php echo esc_url( home_url('/hours/') ); ?>">More Hours <span class="ccl-b-icon pointer-right-open" aria-hidden="true"></span></a></li>
</ul>
</li>
<?php endif; ?>
<li>
<?php if ( $events && ! empty( $events->events ) ) : ?>
<div class="ccl-c-masthead__event">
<span class="ccl-h5"><span class="ccl-b-icon calendar" aria-hidden="true"></span>
<?php date_default_timezone_set('America/Los_Angeles'); ?>
<a href="<?php echo esc_url( $events->events[0]->url->public ); ?>" target="_blank">
<?php $event_date = date( 'D m/d @ g:i a', strtotime( $events->events[0]->start) ); ?>
<span><?php echo $event_date; ?></span> - <span><?php echo apply_filters( 'the_title', $events->events[0]->title ); ?></span>
</a>
</span>
</div>
<?php endif; ?>
<?php
//if notices are available, then run notices UI
if ($notices ) : ?>
<div class="ccl-c-masthead__notice">
<span class="ccl-h5">
<span class="ccl-u-color-red">
<span class="ccl-b-icon alert" aria-hidden="true"></span> Notice:
</span>
<ul class="ccl-u-clean-list">
<?php foreach( $notices as $key => $notice ): ?>
<li class="ccl-c-masthead__status-content"><?php echo apply_filters( 'the_title', $notice['notices_message'] ); ?></li>
<?php endforeach; ?>
</ul>
</span>
</div>
<?php endif; ?>
</li>
</ul>
<?php if ( has_nav_menu( 'header_1' ) ) { ?>
<?php echo \CCL\Helpers\header_sub_menu( $locations[ 'header_1' ], 'ccl-c-sub-menu-container ccl-is-primary ccl-c-masthead__nav-item' ); ?>
<?php } ?>
<?php if ( has_nav_menu( 'header_2' ) ) { ?>
<?php echo \CCL\Helpers\header_sub_menu( $locations[ 'header_2' ], 'ccl-c-sub-menu-container ccl-is-secondary ccl-c-masthead__nav-item' ); ?>
<?php } ?>
</div>
</div>
</header><!-- #masthead -->