File: /var/www/laracopilot.stgviitor.com/laracopilot-wp/wp-content/themes/laracopilot-v2/header.php
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="https://laracopilot.com/wp-content/uploads/2025/09/favicon.ico" />
<meta property="og:logo" content="<?php echo esc_url( site_url( 'wp-content/uploads/2026/04/lC-dark-logo.webp' ) ); ?>" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<nav class="nav" id="nav">
<div class="container nav-inner">
<?php
$header_logo_data = get_field('header_logo', 'option');
$header_logo_url = is_array($header_logo_data) ? $header_logo_data['url'] : $header_logo_data;
?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="nav-logo">
<?php if ($header_logo_url) : ?>
<img src="<?php echo esc_url($header_logo_url); ?>" alt="<?php bloginfo('name'); ?>" />
<?php else : ?>
<img src="https://laracopilot.com/wp-content/uploads/2025/09/favicon.ico" alt="LaraCopilot" />
<span class="nav-logo-txt">LaraCopilot</span>
<?php endif; ?>
</a>
<div class="nav-links">
<?php
$header_nav = get_field('header_navigation', 'option');
if ($header_nav) :
foreach ($header_nav as $index => $item) :
$layout = $item['acf_fc_layout'];
$item_id = 'ni-' . $index;
// Check if this item or any of its sub-items are active
$is_active = false;
$current_url = trailingslashit(home_url($wp->request));
if ($layout === 'product' || $layout === 'grid') {
if (!empty($item['mobile_link']) && trailingslashit(esc_url($item['mobile_link'])) === $current_url) {
$is_active = true;
}
$sub_items = ($layout === 'product') ? $item['features'] : $item['items'];
if (!$is_active && !empty($sub_items)) {
foreach ($sub_items as $sub) {
$sub_link = ($layout === 'product') ? $sub['link'] : $sub['link'];
if (trailingslashit(esc_url($sub_link)) === $current_url) {
$is_active = true;
break;
}
}
}
} else {
if (trailingslashit(esc_url($item['link'])) === $current_url) {
$is_active = true;
}
}
if ($layout === 'product') : ?>
<div class="nav-item <?php echo $is_active ? 'open-active' : ''; ?>" id="<?php echo esc_attr($item_id); ?>">
<a href="<?php echo esc_url($item['mobile_link'] ?: '#'); ?>" class="nav-btn <?php echo $is_active ? 'active' : ''; ?>">
<?php echo esc_html($item['label']); ?>
<svg class="chev" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9" />
</svg>
</a>
<div class="nav-dd">
<div class="dd-product">
<div class="dd-feat-list">
<?php if (!empty($item['features'])) : foreach ($item['features'] as $feat) : ?>
<a href="<?php echo esc_url($feat['link']); ?>" class="dd-feat-item" onclick="closeAllNav()">
<div class="dd-feat-icon">
<?php
$f_icon = $feat['icon'];
$f_icon_url = is_array($f_icon) ? $f_icon['url'] : $f_icon;
if ($f_icon_url) : ?>
<img src="<?php echo esc_url($f_icon_url); ?>" width="16" height="16" alt="" />
<?php endif; ?>
</div>
<div>
<div class="dd-feat-title"><?php echo esc_html($feat['title']); ?></div>
<div class="dd-feat-desc"><?php echo esc_html($feat['description']); ?></div>
</div>
</a>
<?php endforeach;
endif; ?>
</div>
<?php if (!empty($item['featured_block'])) : $fb = $item['featured_block']; ?>
<div class="dd-orivon">
<div class="dd-orivon-tag">
<svg width="9" height="9" viewBox="0 0 24 24" fill="currentColor">
<circle cx="12" cy="12" r="10" />
</svg>
<?php echo esc_html($fb['tag']); ?>
</div>
<div class="dd-orivon-name"><?php echo esc_html($fb['name']); ?></div>
<p class="dd-orivon-desc"><?php echo esc_html($fb['description']); ?></p>
<a href="<?php echo esc_url($fb['link_url']); ?>" class="dd-orivon-link" onclick="closeAllNav()">
<?php echo esc_html($fb['link_label']); ?>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14" />
<path d="M12 5l7 7-7 7" />
</svg>
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php elseif ($layout === 'grid') : ?>
<div class="nav-item <?php echo $is_active ? 'open-active' : ''; ?>" id="<?php echo esc_attr($item_id); ?>">
<a href="<?php echo esc_url($item['mobile_link'] ?: '#'); ?>" class="nav-btn <?php echo $is_active ? 'active' : ''; ?>">
<?php echo esc_html($item['label']); ?>
<svg class="chev" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9" />
</svg>
</a>
<div class="nav-dd">
<div class="dd-usecases">
<div class="dd-uc-head"><?php echo esc_html($item['grid_head']); ?></div>
<div class="dd-uc-grid">
<?php if (!empty($item['items'])) : foreach ($item['items'] as $g_item) : ?>
<a href="<?php echo esc_url($g_item['link']); ?>" class="dd-uc-item" onclick="closeAllNav()">
<div class="dd-uc-icon" style="background:<?php echo esc_attr($g_item['icon_bg'] ?: '#eff6ff'); ?>;">
<?php
$g_icon = $g_item['icon'];
$g_icon_url = is_array($g_icon) ? $g_icon['url'] : $g_icon;
if ($g_icon_url) : ?>
<img src="<?php echo esc_url($g_icon_url); ?>" width="14" height="14" alt="" />
<?php endif; ?>
</div>
<div>
<div class="dd-uc-name"><?php echo esc_html($g_item['name']); ?></div>
<div class="dd-uc-hint"><?php echo esc_html($g_item['hint']); ?></div>
</div>
</a>
<?php endforeach;
endif; ?>
</div>
<?php if (!empty($item['footer_link']['link'])) : ?>
<div class="dd-uc-foot">
<a href="<?php echo esc_url($item['footer_link']['link']); ?>" onclick="closeAllNav()">
<?php echo esc_html($item['footer_link']['label']); ?>
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<path d="M5 12h14" />
<path d="M12 5l7 7-7 7" />
</svg>
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php else : ?>
<a href="<?php echo esc_url($item['link']); ?>" class="nav-link-plain <?php echo $is_active ? 'active' : ''; ?>"><?php echo esc_html($item['label']); ?></a>
<?php endif;
endforeach;
endif;
?>
</div>
<?php $actions = get_field('header_actions', 'option'); ?>
<div class="nav-actions">
<?php if (!empty($actions['enterprise_link']) || !empty($actions['enterprise_label'])) : ?>
<a href="<?php echo esc_url($actions['enterprise_link'] ?: '#'); ?>" class="nav-ent"><?php echo esc_html($actions['enterprise_label'] ?: 'Enterprise'); ?></a>
<?php endif; ?>
<a href="<?php echo esc_url($actions['signin_url'] ?: home_url('/chat')); ?>" class="btn btn-ghost"><?php echo esc_html($actions['signin_label'] ?: 'Sign in'); ?></a>
<a href="<?php echo esc_url($actions['get_started_url'] ?: home_url('/')); ?>" class="btn btn-red"><?php echo esc_html($actions['get_started_label'] ?: 'Get started free'); ?></a>
</div>
<button class="nav-toggle" id="nav-toggle" aria-label="Toggle menu">
<span></span><span></span><span></span>
</button>
</div>
</nav>
<div class="nav-mob" id="nav-mob">
<?php if ($header_nav) : ?>
<?php foreach ($header_nav as $index => $item) :
$layout = $item['acf_fc_layout'];
$sub_id = 'mob-sub-' . $index;
?>
<?php
$is_mob_active = false;
if ($layout === 'product' || $layout === 'grid') {
if (!empty($item['mobile_link']) && trailingslashit(esc_url($item['mobile_link'])) === $current_url) {
$is_mob_active = true;
}
$sub_items = ($layout === 'product') ? $item['features'] : $item['items'];
if (!$is_mob_active && !empty($sub_items)) {
foreach ($sub_items as $sub) {
if (trailingslashit(esc_url(($layout === 'product') ? $sub['link'] : $sub['link'])) === $current_url) {
$is_mob_active = true;
break;
}
}
}
} else {
if (trailingslashit(esc_url($item['link'])) === $current_url) {
$is_mob_active = true;
}
}
?>
<?php if ($layout === 'product' || $layout === 'grid') : ?>
<div class="mob-nav-item <?php echo $is_mob_active ? 'open' : ''; ?>">
<div class="mob-nav-row">
<a href="<?php echo esc_url(!empty($item['mobile_link']) ? $item['mobile_link'] : '#'); ?>"
class="mob-nav-label <?php echo $is_mob_active ? 'active' : ''; ?>"
onclick="<?php echo !empty($item['mobile_link']) ? 'closeMob()' : 'event.preventDefault(); toggleMobSub(\'' . esc_js($sub_id) . '\')'; ?>">
<?php echo esc_html($item['label']); ?>
</a>
<button class="mob-nav-tog" onclick="toggleMobSub('<?php echo esc_js($sub_id); ?>')" aria-label="Toggle submenu">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 12 15 18 9" />
</svg>
</button>
</div>
<div class="mob-nav-sub" id="<?php echo esc_attr($sub_id); ?>">
<div class="mob-nav-sub-inner">
<?php if ($layout === 'product' && !empty($item['features'])) : ?>
<?php foreach ($item['features'] as $feat) : ?>
<a href="<?php echo esc_url($feat['link']); ?>" onclick="closeMob()"><?php echo esc_html($feat['title']); ?></a>
<?php endforeach; ?>
<?php elseif ($layout === 'grid' && !empty($item['items'])) : ?>
<?php foreach ($item['items'] as $g_item) : ?>
<a href="<?php echo esc_url($g_item['link']); ?>" onclick="closeMob()"><?php echo esc_html($g_item['name']); ?></a>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($item['mobile_link'])) : ?>
<a href="<?php echo esc_url($item['mobile_link']); ?>" class="mob-view-all" onclick="closeMob()">View all <?php echo esc_html($item['label']); ?></a>
<?php endif; ?>
</div>
</div>
</div>
<?php else : ?>
<a href="<?php echo esc_url($item['link']); ?>" class="<?php echo $is_mob_active ? 'active' : ''; ?>" onclick="closeMob()"><?php echo esc_html($item['label']); ?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!empty($actions['enterprise_link']) || !empty($actions['enterprise_label'])) : ?>
<a href="<?php echo esc_url($actions['enterprise_link'] ?: '#'); ?>" onclick="closeMob()"><?php echo esc_html($actions['enterprise_label'] ?: 'Enterprise'); ?></a>
<?php endif; ?>
<div class="mob-cta-row">
<a href="<?php echo esc_url($actions['signin_url'] ?: home_url('/chat')); ?>" class="btn btn-outline" style="width:100%;height:44px;"><?php echo esc_html($actions['signin_label'] ?: 'Sign in'); ?></a>
<a href="<?php echo esc_url($actions['get_started_url'] ?: home_url('/')); ?>" class="btn btn-red" style="width:100%;height:44px;"><?php echo esc_html($actions['get_started_label'] ?: 'Get started free'); ?></a>
</div>
</div>