HEX
Server: nginx/1.16.1
System: Linux VM-0-14-centos 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User: www (1000)
PHP: 8.3.31
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.sceybwg.com/wp-content/themes/Modular/header.php
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, viewport-fit=cover">
        <?php wp_head(); ?>
    </head>
    <body <?php body_class();?>>
        <?php
        // 获取产品图集
        $product_gallery = is_single() ? get_post_meta(get_the_ID(), 'product_gallery', true) : '';

        // 获取头部样式设置
        $header_style = wpjam_theme_get_setting('header_style') ?: 'style_1';

        // 获取菜单分割线设置
        $header_line = wpjam_theme_get_setting('header_line');

        // 初始化类名字符串
        $header_class = '';

        // 判断是否是头部样式2/3,如果是 针对 产品详情页面、标签页面、搜索页面 进行优化
        if ($header_style === 'style_3' || $header_style === 'style_2') {
            if (($header_style === 'style_3' && empty($product_gallery) && !is_search() && !is_tag())) {
                $header_class .= ' header-style-3';
            } else {
                $header_class .= ' header-none-img';
            }
        }

        // 判断是否存在 $header_line
        if (!empty($header_line)) {
            $header_class .= ' header-line';
        }
        ?>
        <div class="header<?php echo esc_attr($header_class); ?>">
            <?php
            $header_notice = wpjam_theme_get_setting('header_notice');
            $menu=get_nav_menu_locations();
            if( !empty($header_notice) || !empty($menu["top"]) ){?>
            <div class="header-top">
                <div class="container clearfix">
                    <?php
                    //公告文本
                    if(!empty($header_notice)){
                        echo '<div class="top-notice">'.wpautop($header_notice).'</div>';
                    }
                    //顶部菜单
                    if(!empty($menu["top"])):
                        echo '<ul class="top-menu">';
                        if(function_exists('wp_nav_menu')) wp_nav_menu(array('container' => false, 'items_wrap' => '%3$s', 'theme_location' => 'top'));
                        echo '</ul>';
                    endif;
                    ?>
                </div>
            </div>
            <?php }

            //头部样式
            if(!empty($header_style) && $header_style == 'style_1'){?>
            <div class="container clearfix">
                <button class="hidden-lg hamburger" aria-label="Menu">
                    <span class="h-top"></span>
                    <span class="h-middle"></span>
                    <span class="h-bottom"></span>
                </button>
                <div class="logo img-center">
                <?php
                //Logo
                $header_logo = wpjam_theme_get_setting('logo');
                $image_src = esc_url($header_logo);
                $image_alt = esc_html(dahuzi_get_image_alt($image_src));
                if (!empty($header_logo)):
                    echo '<a href="'.esc_url(home_url('/')).'">';
                        //首页H1标签
                        if (is_front_page()){
                            echo '<h1 class="h1-title">'.get_bloginfo('name').'</h1>';
                        }
                        echo '<img loading="lazy" src="'.$image_src.'" alt="'.$image_alt.'" />';
                    echo '</a>';
                endif;
                echo '</div>';

                //Logo右侧文本
                $logo_title = wpjam_theme_get_setting('logo_title');
                $logo_desc = wpjam_theme_get_setting('logo_desc');
                if(!empty($logo_title)){
                echo '<div class="text">';
                    echo '<strong>'.$logo_title.'</strong>'.$logo_desc.'';
                echo '</div>';
                }

                //联系电话
                $tel_title = wpjam_theme_get_setting('tel_title');
                $tel_number = wpjam_theme_get_setting('tel_number');
                if(!empty($tel_title)||!empty($tel_number)){
                    echo '<div class="tel wow bounce">'.$tel_title.'<strong>'.$tel_number.'</strong></div>';
                }?>
            </div>
            <div class="header-menu header-style-1">
                <div class="container">
                    <ul>
                        <?php if(function_exists('wp_nav_menu')) wp_nav_menu(array('container' => false, 'items_wrap' => '%3$s', 'theme_location' => 'primary' )); ?>
                    </ul>
                </div>
            </div>
            <?php
            }

            //头部样式-2
            if(!empty($header_style) && ( $header_style == 'style_2' || $header_style == 'style_3' )){?>
            <div class="header-style-2">
                <div class="container">
                    <?php
                    //Logo
                    echo '<div class="logo">';
                    $header_logo = wpjam_theme_get_setting('logo');
                    $image_src = esc_url($header_logo ?? '');
                    $image_alt = esc_html(dahuzi_get_image_alt($image_src));

                    $header_logo2 = wpjam_theme_get_setting('logo_2');
                    $image_src2 = esc_url($header_logo2 ?? '');
                    $image_alt2 = esc_html(dahuzi_get_image_alt($image_src2));

                    if (!empty($header_logo)):
                        echo '<a href="'.esc_url(home_url('/')).'">';

                            //首页H1标签
                            if (is_front_page()){
                                echo '<h1 class="h1-title">'.get_bloginfo('name').'</h1>';
                            }

                            // 确定第一个图片的源和替代文本
                            if ( ($header_style === 'style_3' && !empty($product_gallery) ) || ($header_style === 'style_3' && is_search()) ) {
                                $image_src1 = $image_src2;
                                $image_alt1 = $image_alt2;
                            } else {
                                $image_src1 = $image_src;
                                $image_alt1 = $image_alt;
                            }

                            // 输出第一个图片
                            echo '<img loading="lazy" src="'.$image_src1.'" alt="'.$image_alt1.'" class="header-logo-1" />';

                            // 如果存在第二个图片,输出第二个图片
                            if (!empty($header_logo2) && $header_style == 'style_3' && empty($product_gallery) && !is_search()) {
                                echo '<img loading="lazy" src="'.$image_src2.'" alt="'.$image_alt2.'" class="header-logo-2" />';
                            }
                        echo '</a>';
                    endif;
                    echo '</div>';?>
                    <button class="hidden-lg hamburger" aria-label="Menu">
                        <span class="h-top"></span>
                        <span class="h-middle"></span>
                        <span class="h-bottom"></span>
                    </button>
                    <div class="header-menu">
                        <ul>
                            <?php if(function_exists('wp_nav_menu')) wp_nav_menu(array('container' => false, 'items_wrap' => '%3$s', 'theme_location' => 'primary' )); ?>
                        </ul>
                    </div>
                </div>
            </div>
            <?php }?>

        </div>