File: /www/wwwroot/www.byte123.top/wp-content/themes/sUx/footer.php
<?php
/**
* 网站页脚模板 (footer.php)
*
* 这个文件包含了网站的页脚内容,包括:
* - 页脚小工具区域
* - 版权信息
* - 社交媒体链接
* - WordPress必要的脚本加载
*
* @package sUx
*/
// 防止直接访问文件
if (!defined('ABSPATH')) {
exit;
}
?>
</main><!-- #main-content .site-main -->
<!-- 网站页脚 -->
<footer id="colophon" class="site-footer">
<div class="site-container">
<!-- 页脚小工具区域 -->
<div class="footer-widgets">
<!-- 第一列小工具 -->
<?php if (is_active_sidebar('footer-1')) : ?>
<div class="footer-widget">
<?php dynamic_sidebar('footer-1'); ?>
</div>
<?php endif; ?>
<!-- 第二列小工具 -->
<?php if (is_active_sidebar('footer-2')) : ?>
<div class="footer-widget">
<?php dynamic_sidebar('footer-2'); ?>
</div>
<?php endif; ?>
<!-- 第三列小工具 -->
<?php if (is_active_sidebar('footer-3')) : ?>
<div class="footer-widget">
<?php dynamic_sidebar('footer-3'); ?>
</div>
<?php endif; ?>
<!-- 如果没有设置小工具,显示默认信息 -->
<?php if (!is_active_sidebar('footer-1') && !is_active_sidebar('footer-2') && !is_active_sidebar('footer-3')) : ?>
<!-- 公司信息 -->
<div class="footer-widget">
<h3 class="widget-title"><?php _e('关于我们', 'sux'); ?></h3>
<p>
<?php
// 显示网站描述或自定义的公司简介
$company_description = get_theme_mod('sux_company_description', get_bloginfo('description'));
echo esc_html($company_description);
?>
</p>
<!-- 页脚社交媒体链接 -->
<div class="footer-social-links">
<?php if (get_theme_mod('sux_facebook_url')) : ?>
<a href="<?php echo esc_url(get_theme_mod('sux_facebook_url')); ?>" target="_blank" rel="noopener">
<i class="fab fa-facebook-f"></i>
</a>
<?php endif; ?>
<?php if (get_theme_mod('sux_twitter_url')) : ?>
<a href="<?php echo esc_url(get_theme_mod('sux_twitter_url')); ?>" target="_blank" rel="noopener">
<i class="fab fa-twitter"></i>
</a>
<?php endif; ?>
<?php if (get_theme_mod('sux_linkedin_url')) : ?>
<a href="<?php echo esc_url(get_theme_mod('sux_linkedin_url')); ?>" target="_blank" rel="noopener">
<i class="fab fa-linkedin-in"></i>
</a>
<?php endif; ?>
<?php if (get_theme_mod('sux_youtube_url')) : ?>
<a href="<?php echo esc_url(get_theme_mod('sux_youtube_url')); ?>" target="_blank" rel="noopener">
<i class="fab fa-youtube"></i>
</a>
<?php endif; ?>
</div>
</div>
<!-- 联系信息 -->
<div class="footer-widget">
<h3 class="widget-title"><?php _e('联系我们', 'sux'); ?></h3>
<div class="contact-info">
<?php if (get_theme_mod('sux_email')) : ?>
<p>
<i class="fas fa-envelope"></i>
<a href="mailto:<?php echo esc_attr(get_theme_mod('sux_email')); ?>">
<?php echo esc_html(get_theme_mod('sux_email')); ?>
</a>
</p>
<?php endif; ?>
<?php if (get_theme_mod('sux_phone')) : ?>
<p>
<i class="fas fa-phone"></i>
<a href="tel:<?php echo esc_attr(preg_replace('/[^0-9]/', '', get_theme_mod('sux_phone'))); ?>">
<?php echo esc_html(get_theme_mod('sux_phone')); ?>
</a>
</p>
<?php endif; ?>
<?php if (get_theme_mod('sux_address')) : ?>
<p>
<i class="fas fa-map-marker-alt"></i>
<?php echo esc_html(get_theme_mod('sux_address')); ?>
</p>
<?php endif; ?>
</div>
</div>
<!-- 快速链接 -->
<div class="footer-widget">
<h3 class="widget-title"><?php _e('快速链接', 'sux'); ?></h3>
<?php
// 显示页脚菜单
wp_nav_menu(array(
'theme_location' => 'footer',
'menu_class' => 'footer-menu',
'container' => false,
'fallback_cb' => false,
'depth' => 1,
));
?>
</div>
<?php endif; ?>
</div>
<!-- 版权信息区域 -->
<div class="footer-bottom">
<div class="footer-bottom-content">
<div class="footer-left">
<p>
© <?php echo date('Y'); ?> <?php bloginfo('name'); ?>. <?php _e('保留所有权利。', 'sux'); ?>
</p>
</div>
<div class="footer-right">
<p>
<?php
// WordPress主题信息链接
printf(
/* translators: 1: Theme name, 2: Theme author */
esc_html__('%1$s 主题由 %2$s 开发', 'sux'),
'sUx',
'<a href="https://yourwebsite.com">Your Name</a>'
);
?>
</p>
</div>
</div>
</div>
</div>
</footer>
<!-- 返回顶部按钮 -->
<button id="back-to-top" class="back-to-top" aria-label="<?php esc_attr_e('返回顶部', 'sux'); ?>">
<i class="fas fa-arrow-up"></i>
</button>
</div><!-- #page .site-wrapper -->
<!-- WordPress页脚钩子,加载必要的JavaScript文件 -->
<?php wp_footer(); ?>
</body>
</html>