hesabixWpTheme/footer.php
2026-05-22 13:52:15 +03:30

136 lines
8 KiB
PHP

<?php
/**
* فوتر — ستون‌ها فقط وقتی ویجت دارند نمایش داده می‌شوند؛ وگرنه تک‌ستونه
*
* @package Hesabix2
*/
$wrap = 'max-w-6xl mx-auto px-4 sm:px-6 lg:px-8';
$custom_logo_id = get_theme_mod('custom_logo');
$site_icon_url = get_site_icon_url(96);
$has_f1 = is_active_sidebar('footer-1');
$has_f2 = is_active_sidebar('footer-2');
$has_f3 = is_active_sidebar('footer-3');
$footer_widgets_count = (int) $has_f1 + (int) $has_f2 + (int) $has_f3;
$total_cols = 1 + $footer_widgets_count; /* برند همیشه + فقط ستون‌هایی که ویجت دارند */
$grid_class = 'footer-grid footer-cols-' . $total_cols;
$show_default_blocks = ( $footer_widgets_count === 0 ); /* وقتی هیچ ویجتی نیست، بلوک‌های پیش‌فرض */
if ( $show_default_blocks ) {
$total_cols = 4;
$grid_class = 'footer-grid footer-cols-4';
}
?>
<footer class="site-footer mt-20">
<div class="h-1 w-full bg-gradient-to-l from-brand-500 via-brand-400 to-accent-400"></div>
<div class="bg-slate-50/80 border-t border-slate-200/80">
<div class="<?php echo esc_attr($wrap); ?> py-14 sm:py-16">
<div class="<?php echo esc_attr($grid_class); ?>">
<!-- برند — همیشه نمایش داده می‌شود -->
<div class="footer-col footer-col--brand">
<a href="<?php echo esc_url(home_url('/')); ?>" class="footer-brand inline-flex items-center gap-3 mb-4">
<?php if ($custom_logo_id) :
$logo = wp_get_attachment_image_src($custom_logo_id, 'medium');
if ($logo) : ?>
<span class="w-12 h-12 rounded-xl overflow-hidden bg-white shadow-sm ring-1 ring-slate-200/80 flex-shrink-0 flex items-center justify-center">
<img src="<?php echo esc_url($logo[0]); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>" class="w-full h-full object-contain" width="48" height="48">
</span>
<?php endif;
elseif ($site_icon_url) : ?>
<span class="w-12 h-12 rounded-xl overflow-hidden bg-white shadow-sm ring-1 ring-slate-200/80 flex-shrink-0 flex items-center justify-center">
<img src="<?php echo esc_url($site_icon_url); ?>" alt="" class="w-full h-full object-contain" width="48" height="48">
</span>
<?php else : ?>
<span class="w-12 h-12 rounded-xl bg-gradient-to-br from-brand-500 to-brand-600 flex items-center justify-center text-white text-xl font-bold shadow-md shadow-brand-500/20 flex-shrink-0">
<?php echo esc_html(mb_substr(get_bloginfo('name'), 0, 1)); ?>
</span>
<?php endif; ?>
<span class="text-xl font-bold text-slate-800"><?php echo esc_html(get_bloginfo('name')); ?></span>
</a>
<?php if (get_bloginfo('description')) : ?>
<p class="text-slate-500 text-sm leading-relaxed max-w-sm mt-2">
<?php echo esc_html(get_bloginfo('description')); ?>
</p>
<?php else : ?>
<p class="text-slate-500 text-sm leading-relaxed max-w-sm mt-2">
پلتفرم جامع مدیریت کسب‌وکار با هوش مصنوعی: مالی، CRM، عملیات، باشگاه، چت، ورک‌فلو و اتوماسیون هوشمند — ابری، متن‌باز و رایگان.
</p>
<?php endif; ?>
</div>
<?php if ($has_f1) : ?>
<div class="footer-col"><?php dynamic_sidebar('footer-1'); ?></div>
<?php endif; ?>
<?php if ($has_f2) : ?>
<div class="footer-col"><?php dynamic_sidebar('footer-2'); ?></div>
<?php endif; ?>
<?php if ($has_f3) : ?>
<div class="footer-col"><?php dynamic_sidebar('footer-3'); ?></div>
<?php endif; ?>
<?php
/* وقتی هیچ ویجت فوتر تعریف نشده، بلوک‌های پیش‌فرض را نشان بده تا سایت خالی نباشد */
if ( $show_default_blocks ) :
?>
<div class="footer-col">
<h4 class="footer-heading">دسترسی سریع</h4>
<?php if (has_nav_menu('footer')) : ?>
<?php wp_nav_menu(array(
'theme_location' => 'footer',
'container' => false,
'menu_class' => 'footer-links',
)); ?>
<?php else : ?>
<ul class="footer-links">
<li><a href="<?php echo esc_url(home_url('/')); ?>#features">امکانات پلتفرم</a></li>
<li><a href="<?php echo esc_url(home_url('/')); ?>#online-business">کسب‌وکار آنلاین</a></li>
<li><a href="<?php echo esc_url(home_url('/')); ?>#guide">راهنمای جامع</a></li>
<li><a href="<?php echo esc_url(home_url('/pishibani-sazmani/')); ?>">پشتیبانی سازمانی</a></li>
<li><a href="<?php echo esc_url(get_option('page_for_posts') ? get_permalink(get_option('page_for_posts')) : home_url('/')); ?>">وبلاگ</a></li>
<li><a href="<?php echo esc_url(home_url('/')); ?>#supporters">حامیان</a></li>
<li><a href="<?php echo esc_url(home_url('/contact/')); ?>">تماس با ما</a></li>
</ul>
<?php endif; ?>
</div>
<div class="footer-col">
<h4 class="footer-heading">منابع</h4>
<ul class="footer-links">
<li><a href="https://source.hesabix.ir">مخازن کد</a></li>
<li><a href="#">مستندات API</a></li>
<li><a href="#">گواهی‌های اعتماد</a></li>
</ul>
</div>
<div class="footer-col">
<h4 class="footer-heading">در ارتباط باشید</h4>
<p class="text-slate-500 text-sm leading-relaxed mb-4">
سوال یا پیشنهاد دارید؟ با تیم پشتیبانی در تماس باشید.
</p>
<a href="<?php echo esc_url(home_url('/contact/')); ?>" class="inline-flex items-center justify-center gap-2 bg-brand-500 hover:bg-brand-600 text-white font-medium px-5 py-2.5 rounded-xl text-sm transition shadow-md hover:shadow-lg">
تماس با پشتیبانی
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="bg-slate-800 text-slate-300">
<div class="<?php echo esc_attr($wrap); ?> py-5 sm:py-6">
<div class="flex flex-col sm:flex-row items-center justify-between gap-4 text-sm">
<p class="order-2 sm:order-1 text-slate-400 text-center sm:text-right">
© <?php echo esc_html(gmdate('Y')); ?> <?php echo esc_html(get_bloginfo('name')); ?>. تمامی حقوق محفوظ است.
</p>
<p class="order-1 sm:order-2 text-slate-300 text-center sm:text-left">
با خاطری آسوده استوار بر روی راهکارهای ابری <a href="https://parspack.com" target="_blank" rel="noopener noreferrer" class="footer-parspack-link">پارسپک</a>
</p>
</div>
</div>
</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>