-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
117 lines (107 loc) · 3.52 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
<?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 Newspaper X
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php endif; ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<?php wp_body_open(); ?>
<?php
/**
* Enable / Disable the top bar
*/
$top_bar = get_theme_mod( 'newspaper_x_enable_top_bar', true );
if ( $top_bar ) :
get_template_part( 'template-parts/top-header' );
endif;
?>
<header id="masthead" class="site-header" role="banner">
<div class="site-branding container">
<div class="row">
<div class="col-md-4 header-logo">
<?php
$header_textcolor = get_theme_mod( 'header_textcolor' );
if ( function_exists( 'the_custom_logo' ) ) {
if ( has_custom_logo() ) {
the_custom_logo();
} else { ?>
<?php
if ( $header_textcolor !== 'blank' ):
?>
<a class="site-title"
href="<?php echo esc_url( get_home_url() ) ?>"> <?php echo esc_html( get_option( 'blogname', 'newspaper-x' ) ) ?></a>
<?php endif; ?>
<?php
$description = get_bloginfo( 'description', 'display' );
if ( $header_textcolor !== 'blank' && ! empty( $description ) ) : ?>
<p class="site-description"><?php echo wp_kses_post( $description ); /* WPCS: xss ok. */ ?></p>
<?php
endif;
}
}
?>
</div>
<?php
$enable_banner = get_theme_mod( 'newspaper_x_show_banner_on_homepage', true );
?>
<?php if ( $enable_banner ): ?>
<div class="col-md-8 header-banner">
<?php
$banner = get_theme_mod( 'newspaper_x_banner_type', 'image' );
get_template_part( 'template-parts/banner/banner', $banner );
?>
</div>
<?php endif; ?>
</div>
</div><!-- .site-branding -->
<nav id="site-navigation" class="main-navigation" role="navigation">
<div class="container">
<div class="row">
<div class="col-md-12">
<button class="menu-toggle" aria-controls="primary-menu"
aria-expanded="false"><span class="fa fa-bars"></span></button>
<?php
if ( has_nav_menu( 'primary' ) ) {
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_id' => 'primary-menu'
) );
} else {
?>
<div class="menu-all-pages-container">
<ul id="primary-menu" class="menu nav-menu" aria-expanded="false">
<?php if ( current_user_can( 'administrator' ) ): ?>
<li>
<a href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"><?php echo esc_html__( 'Add a menu', 'newspaper-x' ); ?></a>
</li>
<?php else: ?>
<li>
<a href="<?php echo esc_url( get_home_url() ); ?>"><?php echo esc_html__( 'Home', 'newspaper-x' ); ?></a>
</li>
<?php endif; ?>
</ul>
</div>
<?php
} ?>
</div>
</div>
</div>
</nav><!-- #site-navigation -->
</header><!-- #masthead -->
<div id="content" class="site-content container">