forked from ColorlibHQ/illdy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
executable file
·120 lines (111 loc) · 4.47 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
<?php
/**
* The template for displaying the header.
*
* @package WordPress
* @subpackage illdy
*/
?>
<?php
$logo_id = get_theme_mod( 'custom_logo' );
$logo_image = wp_get_attachment_image_src( $logo_id, 'full' );
$text_logo = get_theme_mod( 'illdy_text_logo', __( 'Illdy', 'illdy' ) );
$jumbotron_general_image = get_theme_mod( 'illdy_jumbotron_general_image', esc_url( get_template_directory_uri() . '/layout/images/front-page/front-page-header.png' ) );
$jumbotron_single_image = get_theme_mod( 'illdy_jumbotron_enable_featured_image', false );
$jumbotron_parallax_enable = get_theme_mod( 'illdy_jumbotron_enable_parallax_effect', true );
$preloader_enable = get_theme_mod( 'illdy_preloader_enable', 1 );
$isMobileSafari = preg_match('/(iPod|iPhone|iPad)/', $_SERVER['HTTP_USER_AGENT']);
$style = '';
if ( get_option( 'show_on_front' ) == 'page' && is_front_page() ) {
if ( $jumbotron_general_image ) {
$style = 'background-image: url(' . esc_url( $jumbotron_general_image ) . ');';
}
} else if ( ( is_single() || is_page() ) && $jumbotron_single_image == true ) {
global $post;
if ( has_post_thumbnail( $post->ID ) ) {
$style = 'background-image: url(' . esc_url( get_the_post_thumbnail_url( $post->ID, 'full' ) ) . ');';
}else {
$style = 'background-image: url(' . get_header_image() . ');';
}
} else {
$style = 'background-image: url(' . get_header_image() . ');';
}
$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
// append the parallax effect
if ( $isMobileSafari == true ) {
$style .= 'background-attachment: scroll;';
} elseif ( $jumbotron_parallax_enable == true ) {
$style .= 'background-attachment: fixed;';
}
if ( ( is_single() || is_page() || is_archive() ) && get_theme_mod( 'illdy_archive_page_background_stretch' ) == 2 ) {
$style .= 'background-size:contain;background-repeat:no-repeat;';
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php if ( $preloader_enable == 1 ): ?>
<div class="pace-overlay"></div>
<?php endif; ?>
<header id="header" class="<?php if ( get_option( 'show_on_front' ) == 'page' && is_front_page() ): echo 'header-front-page';
else: echo 'header-blog'; endif; ?>" style="<?php echo $style ?>">
<div class="top-header">
<div class="container">
<div class="row">
<div class="col-sm-4 col-xs-8">
<?php if ( ! empty( $logo_image ) ) { ?>
<?php echo '<a href="' . esc_url( home_url() ) . '"><img src="' . esc_url( $logo_image[0] ) . '" /></a>'; ?>
<?php } else { ?>
<?php if ( get_option( 'show_on_front' ) == 'page' ) { ?>
<a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( $text_logo ); ?>" class="header-logo"><?php echo esc_html( $text_logo ); ?></a>
<?php } else { // front-page option ?>
<a href="<?php echo esc_url( home_url() ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" class="header-logo"><?php echo esc_html( get_bloginfo( 'name' ) ); ?></a>
<?php } ?>
<?php } ?>
</div><!--/.col-sm-2-->
<div class="col-sm-8 col-xs-4">
<nav class="header-navigation">
<?php
wp_nav_menu( array(
'theme_location' => 'primary-menu',
'menu' => '',
'container' => false,
'menu_class' => 'clearfix',
'menu_id' => '',
) );
?>
</nav>
<button class="open-responsive-menu"><i class="fa fa-bars"></i></button>
</div><!--/.col-sm-10-->
</div><!--/.row-->
</div><!--/.container-->
</div><!--/.top-header-->
<nav class="responsive-menu">
<ul>
<?php
wp_nav_menu( array(
'theme_location' => 'primary-menu',
'menu' => '',
'container' => '',
'container_class' => '',
'container_id' => '',
'menu_class' => '',
'menu_id' => '',
'items_wrap' => '%3$s',
) );
?>
</ul>
</nav><!--/.responsive-menu-->
<?php
if ( get_option( 'show_on_front' ) == 'page' && is_front_page() ):
get_template_part( 'sections/front-page', 'bottom-header' );
else:
get_template_part( 'sections/blog', 'bottom-header' );
endif;
?>
</header><!--/#header-->