ifnex/03_WordPress/wp-content/themes/ifnex/header.php
Kazem Alghasi c54530d8da refactor(admin): optimize dashboard layout and enhance sidebar UX
Refactor the Filament admin dashboard by decoupling the recent shipments
logic into a dedicated widget and improving the sidebar navigation
experience. Additionally, implement several improvements to the
WordPress theme for better client-side usability.

Laravel/Filament:
- Extract `RecentShipmentsWidget` from `DashboardInfoWidget` to improve
  modularization and dashboard performance.
- Update widget sorting and layout to accommodate the new structure.
- Inject custom CSS and Alpine.js logic into the admin head to provide
  sidebar group toggling and a "collapse all" utility.
- Improve sidebar group label visibility and hover states.

WordPress:
- Implement `ifnex_login_url()` to support Polylang-aware, language-specific
  login pages.
- Hide the WordPress admin bar for non-administrator users to provide a
  cleaner client interface.
- Add conditional rendering for the registration link in the login
  template based on WordPress user registration settings.
2026-10-03 07:01:54 +03:30

66 lines
2.7 KiB
PHP

<!DOCTYPE html>
<html <?php language_attributes(); ?> dir="<?php echo ifnex_text_direction(); ?>" lang="<?php echo ifnex_is_english() ? 'en' : 'fa'; ?>">
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#f59e0b">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<?php
// لینک‌های هوشمند بر اساس وضعیت ورود کاربر
if (is_user_logged_in()) {
$login_btn_url = esc_url(home_url('/my-account/'));
$login_btn_text = ifnex_t('پنل کاربری', 'Dashboard');
$login_btn_class = 'btn btn-primary';
} else {
$login_btn_url = esc_url(ifnex_login_url());
$login_btn_text = ifnex_t('ورود مشتریان', 'Client Login');
$login_btn_class = 'btn btn-secondary';
}
$order_btn_url = esc_url(home_url('/my-account/?tab=new-order'));
?>
<!-- Header -->
<header class="site-header" id="site-header">
<div class="container">
<div class="header-inner">
<?php echo ifnex_get_logo_html('header'); ?>
<nav class="main-nav" aria-label="<?php echo ifnex_is_english() ? 'Main menu' : 'منوی اصلی'; ?>">
<?php ifnex_render_primary_menu(); ?>
</nav>
<div class="header-actions">
<?php echo ifnex_language_switcher(); ?>
<a href="<?php echo $login_btn_url; ?>" class="<?php echo $login_btn_class; ?>">
<?php echo $login_btn_text; ?>
</a>
<a href="<?php echo $order_btn_url; ?>" class="btn btn-primary">
<?php echo ifnex_t('سفارش جدید', 'New Order'); ?>
</a>
<button class="hamburger" id="hamburger" aria-label="<?php echo ifnex_is_english() ? 'Menu' : 'منو'; ?>" aria-expanded="false">
<span></span><span></span><span></span>
</button>
</div>
</div>
</div>
</header>
<!-- Mobile Drawer -->
<div class="mobile-drawer" id="mobile-drawer" aria-hidden="true">
<nav class="mobile-nav" aria-label="<?php echo ifnex_is_english() ? 'Mobile menu' : 'منوی موبایل'; ?>">
<?php ifnex_render_primary_menu(); ?>
</nav>
<div class="mobile-drawer-actions">
<?php echo ifnex_language_switcher_mobile(); ?>
<a href="<?php echo $login_btn_url; ?>" class="<?php echo $login_btn_class; ?>">
<?php echo $login_btn_text; ?>
</a>
<a href="<?php echo $order_btn_url; ?>" class="btn btn-primary">
<?php echo ifnex_t('سفارش جدید', 'New Order'); ?>
</a>
</div>
</div>
<main id="main-content" class="site-main">