-
Notifications
You must be signed in to change notification settings - Fork 1
/
header.php
71 lines (66 loc) · 3.78 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
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="craftnce_site">
<a class="skip-link screen-reader-text" href="#content">
<?php _e( 'Skip to Content', 'craftnce' ); ?>
</a>
<!-- Header Navigation -->
<header id="site-header" class="sticky-top bg-light shadow-sm">
<nav class="navbar navbar-expand-lg navbar-light py-2">
<div class="container">
<a class="navbar-brand text-primary fw-bolder" href="<?php echo esc_url(home_url()); ?>">
<?php
if(current_theme_supports('custom-logo')) {
$craftnce_custom_logo_id = get_theme_mod( 'custom_logo' );
$logo = wp_get_attachment_image_src( $craftnce_custom_logo_id , 'full' );
if($logo) {
?>
<img src="<?php echo esc_url($logo[0]); ?>" class="img-fluid" alt="">
<?php
} else {
?>
<img src="<?php echo esc_url(get_template_directory_uri() . '/assets/img/craftnce.png'); ?>">
<?php
}
}
?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="<?php esc_attr_e('Toggle navigation', 'craftnce'); ?>">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse flex-grow-0 gap-3" id="navbarSupportedContent">
<?php
if(has_nav_menu('primary-menu')) {
wp_nav_menu(array(
'theme_location' => 'primary-menu',
'menu_class' => '',
'menu-container' => 'false',
'fallback_cb' => '__return_false',
'items_wrap' => '<ul id="%1$s" class="navbar-nav ms-auto mb-2 mb-lg-0 text-sm %2$s">%3$s</ul>',
'depth' => 2,
'walker' => new craftnce_wp_nav_menu_walker(),
));
} else {
echo '<a class="text-primary text-sm nav-menu-create-notice" href="'.home_url('/wp-admin/nav-menus.php').'">Create nav menu first</a>';
}
?>
<?php
if(get_theme_mod('craftnce_header_menu_show_last_button_label_settings')) :
?>
<a href="<?php echo esc_url(get_theme_mod('craftnce_header_menu_last_button_link_settings', 1)); ?>" class="btn btn-primary rounded-pill text-sm">
<?php
echo esc_html( get_theme_mod('craftnce_header_menu_last_button_label_settings', 'contact us') );
?>
</a>
<?php endif; ?>
</div>
</div>
</nav>
</header>