forked from jazzsequence/museum-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
executable file
·115 lines (102 loc) · 4.92 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
<!DOCTYPE html>
<?php tha_html_before(); ?>
<html <?php language_attributes(); ?>>
<head>
<?php tha_head_top(); ?>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<?php $options = get_option( 'ap_core_theme_options' ); ?>
<?php
$ap_core_headerimg = null;
if ( !isset( $options['site-title'] ) || $options['site-title'] == false ) {
$ap_core_headerimg_before = '<a href="' . esc_url( home_url() ) . '" title="' . get_bloginfo('title') . '">';
$ap_core_headerimg_after = '</a>';
} else {
$ap_core_headerimg_before = null;
$ap_core_headerimg_after = null;
}
$ap_core_fixed_nav = null;
if ( isset( $options['nav-menu'] ) && ( true == $options['nav-menu'] ) ) {
$ap_core_fixed_nav = 'bs-fixed-nav';
}
$ap_core_navbar_inverse = null;
if ( isset( $options['navbar-inverse'] ) && ( true == $options['navbar-inverse'] ) ) {
$ap_core_navbar_inverse = 'navbar-inverse';
} else {
$ap_core_navbar_inverse = 'navbar-default';
}
?>
<title><?php wp_title(); ?></title>
<?php tha_head_bottom(); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class( $ap_core_fixed_nav ); ?>>
<?php tha_body_top(); ?>
<div class="container" id="wrap">
<?php tha_header_before(); ?>
<header>
<?php tha_header_top(); ?>
<div class="navbar-header">
<?php
$nav_1 = has_nav_menu( 'top' );
$nav_2 = has_nav_menu( 'main' );
$data_target = null;
if ( !empty( $nav_1 ) ) {
$data_target = '.navbar-1-collapse';
} elseif ( !empty( $nav_2 ) ) {
$data_target = '.navbar-2-collapse';
}
if ( !is_null( $data_target ) ) : ?>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="<?php echo $data_target; ?>">
<i class="icon-reorder" title="Menu"></i>
</button>
<?php endif; ?>
</div>
<?php
$ap_core_navbar_default = array( 'container' => 'nav', 'container_class' => 'topnav ' . $ap_core_navbar_inverse . ' collapse navbar-collapse navbar-1-collapse', 'theme_location' => 'top', 'fallback_cb' => false, 'menu_class' => 'nav navbar-nav', 'walker' => new AP_Core_WP_Bootstrap_Navwalker() );
$ap_core_navbar_fixed = array( 'container' => 'nav', 'container_class' => 'topnav ' . $ap_core_navbar_inverse . ' navbar navbar-collapse collapse navbar-1-collapse navbar-default navbar-fixed-top', 'theme_location' => 'top', 'fallback_cb' => false, 'menu_class' => 'nav navbar-nav', 'walker' => new AP_Core_WP_Bootstrap_Navwalker() );
if ( $ap_core_fixed_nav ) {
// if the nav menu is fixed
wp_nav_menu( $ap_core_navbar_fixed );
} else {
wp_nav_menu( $ap_core_navbar_default );
} ?>
<?php
$ap_core_header_image_width = get_theme_support( 'custom-header', 'width' );
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
$image[1] >= $ap_core_header_image_width ) :
// there's a header image
$ap_core_headerimg = true;
?>
<div class="headerimg">
<?php echo wp_kses_post( $ap_core_headerimg_before ); ?>
<?php echo get_the_post_thumbnail( $post->ID ); ?>
<?php echo wp_kses_post( $ap_core_headerimg_after ); ?>
<?php elseif ( get_header_image() ) :
$ap_core_headerimg = true;
$ap_core_header_image_width = get_custom_header()->width;
$ap_core_header_image_height = get_custom_header()->height;
?>
<div class="headerimg">
<?php echo wp_kses_post( $ap_core_headerimg_before ); ?>
<img src="<?php header_image(); ?>" width="<?php echo esc_attr( $ap_core_header_image_width ); ?>" height="<?php echo esc_attr( $ap_core_header_image_height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
<?php echo wp_kses_post( $ap_core_headerimg_after ); ?>
<?php endif; ?>
<hgroup class="siteinfo">
<?php if ( isset( $options['alth1'] ) && $options['alth1'] == true) { ?>
<h2 class="alt"><a href="<?php echo esc_url( home_url() ) ?>" title="<?php bloginfo('title'); ?>"><?php bloginfo('title'); ?></a></h2>
<h3><?php bloginfo('description'); ?></h3>
<?php } else { ?>
<h2><a href="<?php echo esc_url( home_url() ) ?>" title="<?php bloginfo('title'); ?>"><?php bloginfo('title'); ?></a></h2>
<h3 class="alt"><?php bloginfo('description'); ?></h3>
<?php } ?>
</hgroup>
<?php if ( $ap_core_headerimg ) { ?>
</div>
<?php } ?>
<?php wp_nav_menu( array( 'container' => 'nav', 'container_class' => 'mainnav collapse navbar-collapse navbar-2-collapse', 'theme_location' => 'main', 'fallback_cb' => false, 'menu_class' => 'nav navbar-nav', 'walker' => new AP_Core_WP_Bootstrap_Navwalker() ) ); ?>
<?php tha_header_bottom(); ?>
</header>
<?php tha_header_after(); ?>
<div class="row">