<?php
/**
 * 顶部菜单栏样式
 *
 */
?>

<?php

$web_mod = get_cu('web_mod','classic');

if (!function_exists('pix_header_search_overlay')) {
function pix_header_search_overlay(){
    $query = get_search_query();
    $hot_terms = get_terms(array(
        'taxonomy' => 'category',
        'orderby' => 'count',
        'order' => 'DESC',
        'number' => 6,
        'hide_empty' => true,
    ));

    $hot_html = '';
    if (!is_wp_error($hot_terms) && !empty($hot_terms)) {
        foreach ($hot_terms as $term) {
            $hot_html .= '<a href="' . esc_url(get_term_link($term)) . '">' . esc_html($term->name) . '</a>';
        }
    }

    return '<div class="pix-search-overlay" aria-hidden="true">
        <div class="pix-search-backdrop"></div>
        <div class="pix-search-panel" role="dialog" aria-modal="true" aria-label="站内搜索">
            <button type="button" class="pix-search-close" aria-label="关闭搜索"><i class="ri-close-line"></i></button>
            <div class="pix-search-kicker">Search PixPro</div>
            <h2>找文章、资源和灵感</h2>
            <form class="pix-search-form" role="search" method="get" action="' . esc_url(home_url('/')) . '">
                <i class="ri-search-2-line"></i>
                <input class="pix-search-input" type="search" name="s" value="' . esc_attr($query) . '" placeholder="输入关键词后回车搜索" autocomplete="off">
                <button type="submit">搜索</button>
            </form>
            ' . ($hot_html ? '<div class="pix-search-hot"><span>热门分类</span><div>' . $hot_html . '</div></div>' : '') . '
        </div>
    </div>';
}
}

if($web_mod == 'classic'){
     echo Classic_mod::classic_header();
} else {
     echo Nav_builder::nav_layout();
}

echo pix_header_search_overlay();






