File: /www/wwwroot/www.sceybwg.com/wp-content/themes/Modular/template/module-page/theme-slider.php
<?php
/**
* Template: 幻灯片/滑块
* @Author: 大胡子
* @Email: dahuzi@xintheme.com
* @Link: www.xintheme.com
* @Date: 2023-08-01 07:27:28
* @Last Modified by: dahuzi
* @Last Modified time: 2024-11-10 22:15:26
*/
if(is_array($module_content)){?>
<?php
if( $module_setting['md_width'] != 'full' ){
echo '<div class="section">';
echo '<div class="container">';
}
//模块标题
if( !empty($module_setting['title_display']) ){
echo '<div class="section-title '.$wow_style.'">';
if( !empty($module_title) ){
echo '<strong>'.$module_title.'</strong>';
}
if( !empty($module_desc) ){
echo '<p>'.$module_desc.'</p>';
}
echo '</div>';
}
$banner_h = '';
$banner_h_pc = $module_setting['banner_h_pc'] ?? '';
$banner_h_mb = $module_setting['banner_h_mb'] ?? '';
if( !empty($banner_h_pc) || !empty($banner_h_mb) ){
if( !empty($banner_h_pc) ){
$banner_h_pc = '--banner_h_pc:'.$banner_h_pc.'px;';
}
if( !empty($banner_h_mb) ){
$banner_h_mb = '--banner_h_mb:'.$banner_h_mb.'px;';
}
$banner_h = 'style="'.$banner_h_pc.$banner_h_mb.'"';
}
?>
<div class="swiper swiper-container module-banner swiper-banner <?php echo $wow_style;?>" <?php echo $banner_h;?>>
<div class="swiper-wrapper">
<?php
foreach ($module_content as $value) {
$banner_type = $value['banner_type'] ?? 'img';
$video_url = $value['video_url'] ?? '';
$banner_image = $value['image'] ?? '';
$banner_mb_image = $value['mb_image'] ?? '';
$banner_url = $value['banner_url'] ?? '';
$banner_title = $value['banner_title'] ?? '';
$banner_desc = $value['banner_desc'] ?? '';
$banner_align = $value['banner_align'] ?? '';
$banner_target = isset($value['banner_target']) && $value['banner_target'] == '_blank' ? 'target="_blank"' : '';
//图片遮罩层和文本颜色
$banner_button = $value['banner_button'] ?? '';
$banner_text_color = $value['banner_text_color'] ?? '';
$banner_mask_color = $value['banner_mask_color'] ?? '';
$banner_button_bg = $value['banner_button_bg'] ?? '';
$banner_button_co = $value['banner_button_co'] ?? '';
$text_color = $banner_text_color ? '--banner_text_color:'.$banner_text_color.';' : '';
$mask_color = $banner_mask_color ? '--banner_mask_color:'.$banner_mask_color.';' : '';
$button_bg = $banner_button_bg && $banner_button ? '--banner_button_bg:'.$banner_button_bg.';' : '';
$button_color = $banner_button_co && $banner_button ? '--banner_button_co:'.$banner_button_co.';' : '';
$banner_mask_style = ($mask_color || $text_color || $button_bg || $button_color) ? 'style="'.$mask_color.$text_color.$button_bg.$button_color.'"' : '';
$banner_mask_class = $mask_color ? ' banner-mask' : '';
?>
<div class="swiper-slide<?php echo $banner_mask_class;?>" <?php echo $banner_mask_style;?>>
<?php
//视频
if( $banner_type == 'video' && !empty($video_url) ){
echo '<video muted preload="auto" playsinline><source src="'.$video_url.'" type="video/mp4"></video>';
}
//图片
if( $banner_type == 'img' ){
echo '<img fetchpriority=high class="pc-img" src="'.$banner_image.'" alt="'.dahuzi_get_image_alt($banner_image).'" />';
echo '<img fetchpriority=high class="mobile-img" src="'.$banner_mb_image.'" alt="'.dahuzi_get_image_alt($banner_mb_image).'" />';
}
//幻灯片标题
if( !empty($banner_title) || !empty($banner_desc) ){?>
<div class="swiper-text align-<?php echo $banner_align;?>">
<div class="container">
<h2><?php echo $banner_title;?></h2>
<?php
//描述
echo wpautop($banner_desc);
//自定义按钮
if( !empty($banner_url) && !empty($banner_button) ){
echo '<a class="banner-url" href="'.esc_url($banner_url).'" '.$banner_target.'>'.$banner_button.'</a>';
}
?>
</div>
</div>
<?php }?>
<?php
//跳转链接
if( !empty($banner_url) && empty($banner_button) ){?>
<a class="swiper-url" aria-label="url" href="<?php echo $banner_url;?>" <?php echo $banner_target;?>></a>
<?php }?>
</div>
<?php
}
?>
</div>
<?php
//分页导航
if( $module_setting['nav_style'] != 'none' ){
echo '<div class="swiper-pagination pagination-'.$module_setting['nav_style'].'"></div>';
}
//切换按钮
if( $module_setting['previous_next'] != 'none' ){
echo '<div class="swiper-button-prev"></div>';
echo '<div class="swiper-button-next"></div>';
}
?>
</div>
<?php
if( $module_setting['md_width'] != 'full' ){
echo '</div>';
echo '</div>';
}
}?>
<?php
//echo wpjam_print_r( $module_setting );
//echo wpjam_print_r( $module_content );
//echo wpjam_print_r( $module_style );