Repository navigation
Expand file tree
/
Copy pathheader.php
More file actions
151 lines (140 loc) · 10.2 KB
/
Copy pathheader.php
File metadata and controls
151 lines (140 loc) · 10.2 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>
<body <?php body_class('bg-brand-darker text-gray-200 font-sans antialiased'); ?>>
<?php wp_body_open(); ?>
<header class="relative z-50 bg-brand-dark shadow-md border-b border-gray-800">
<div class="container mx-auto px-4 py-4 flex items-center justify-between border-b border-gray-800">
<!-- Logo -->
<div class="flex items-center">
<?php
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
the_custom_logo();
} else {
?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" class="text-2xl font-bold text-brand-accent tracking-tighter">
<?php bloginfo( 'name' ); ?>
</a>
<?php
}
?>
</div>
<!-- Search and Login -->
<div class="flex items-center space-x-4">
<div class="relative hidden sm:block">
<form action="<?php echo esc_url( home_url( "/" ) ); ?>" method="get" class="relative">
<input type="text" id="movie-search-input" name="s" placeholder="<?php esc_attr_e( 'Filter movies', 'jw_mymo' ); ?>" class="bg-brand-darker border border-gray-700 text-sm rounded-full focus:ring-brand-accent focus:border-brand-accent block w-full pl-10 p-2 text-gray-200 placeholder-gray-500" value="<?php echo get_search_query(); ?>" autocomplete="off">
<input type="hidden" name="post_type" value="movie">
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
</div>
</form>
<div id="movie-search-results" class="absolute top-full mt-2 w-full bg-brand-darker border border-gray-700 rounded-md shadow-lg hidden z-50 overflow-hidden"></div>
</div>
<?php
$bookmark_url = '#';
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$avatar_url = get_avatar_url( $current_user->ID, array( 'size' => 32 ) );
// Determine Profile URL
$profile_pages = get_pages( array(
'meta_key' => '_wp_page_template',
'meta_value' => 'templates/profile.php',
'number' => 1
) );
$profile_url = !empty( $profile_pages ) ? get_permalink( $profile_pages[0]->ID ) : get_edit_profile_url();
$password_url = !empty( $profile_pages ) ? add_query_arg( 'action', 'password', get_permalink( $profile_pages[0]->ID ) ) : get_edit_profile_url();
$bookmark_url = !empty( $profile_pages ) ? add_query_arg( 'action', 'bookmarks', get_permalink( $profile_pages[0]->ID ) ) : '#';
}
?>
<a href="<?php echo esc_url( $bookmark_url ); ?>" <?php echo !is_user_logged_in() ? 'onclick="document.getElementById(\'nav-login-btn\').click(); return false;"' : ''; ?> class="text-gray-300 hover:text-brand-accent transition-colors">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"></path></svg>
</a>
<?php if ( is_user_logged_in() ) : ?>
<div class="relative">
<button id="user-menu-btn" class="flex items-center space-x-2 focus:outline-none cursor-pointer">
<img data-src="<?php echo esc_url( $avatar_url ); ?>" alt="<?php esc_attr_e( 'User Avatar', 'jw_mymo' ); ?>" class="lazyload w-8 h-8 rounded-full border border-gray-600">
</button>
<div id="user-menu-dropdown" class="absolute right-0 mt-2 w-48 bg-brand-dark border border-gray-700 rounded-md shadow-lg py-2 hidden z-50">
<?php if ( current_user_can( 'manage_options' ) ) : ?>
<a href="<?php echo esc_url( admin_url() ); ?>" class="flex items-center gap-3 px-4 py-2 text-sm text-gray-200 hover:bg-brand-darker hover:text-brand-accent transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
<?php esc_html_e( 'Admin Area', 'jw_mymo' ); ?>
</a>
<?php endif; ?>
<a href="<?php echo esc_url( $profile_url ); ?>" class="flex items-center gap-3 px-4 py-2 text-sm text-gray-200 hover:bg-brand-darker hover:text-brand-accent transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
<?php esc_html_e( 'Profile', 'jw_mymo' ); ?>
</a>
<a href="<?php echo esc_url( $password_url ); ?>" class="flex items-center gap-3 px-4 py-2 text-sm text-gray-200 hover:bg-brand-darker hover:text-brand-accent transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg>
<?php esc_html_e( 'Change password', 'jw_mymo' ); ?>
</a>
<a href="<?php echo esc_url( wp_logout_url( home_url() ) ); ?>" class="flex items-center gap-3 px-4 py-2 text-sm text-red-400 hover:bg-brand-darker hover:text-red-500 transition-colors">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path></svg>
<?php esc_html_e( 'Logout', 'jw_mymo' ); ?>
</a>
</div>
</div>
<?php else : ?>
<a href="#" id="nav-login-btn" class="bg-brand-accent hover:bg-blue-500 text-white font-semibold py-2 px-4 rounded transition-colors text-sm">
<?php esc_html_e( 'Login', 'jw_mymo' ); ?>
</a>
<?php endif; ?>
<!-- Mobile Menu Button -->
<button id="mobile-menu-btn" class="md:hidden text-gray-300 hover:text-white focus:outline-none focus:text-white">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</div>
</div>
<!-- Secondary Desktop Navigation -->
<div class="container mx-auto px-4 py-3 hidden md:block">
<nav>
<?php
if ( has_nav_menu( 'main-menu' ) ) {
wp_nav_menu( array(
'theme_location' => 'main-menu',
'container' => false,
'menu_class' => 'flex space-x-8 text-sm font-medium text-gray-300',
'fallback_cb' => false,
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'walker' => new MyMo_Walker_Nav_Menu(),
) );
}
?>
</nav>
</div>
<!-- Mobile Navigation Overlay -->
<div id="mobile-menu-backdrop" class="fixed inset-0 bg-black bg-opacity-50 z-40 hidden md:hidden"></div>
<!-- Mobile Navigation -->
<div id="mobile-menu-container" class="fixed top-0 right-0 h-full w-64 bg-brand-dark z-50 transform translate-x-full transition-transform duration-300 md:hidden overflow-y-auto border-l border-gray-800 shadow-xl">
<div class="p-4 border-b border-gray-800 flex justify-between items-center">
<span class="text-lg font-bold text-brand-accent">Menu</span>
<button id="mobile-menu-close-btn" class="text-gray-400 hover:text-white focus:outline-none">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<nav class="p-4">
<?php
if ( has_nav_menu( 'main-menu' ) ) {
wp_nav_menu( array(
'theme_location' => 'main-menu',
'container' => false,
'menu_class' => 'flex flex-col space-y-2',
'fallback_cb' => false,
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
'walker' => new MyMo_Walker_Nav_Menu_Mobile(),
) );
}
?>
</nav>
</div>
</header>