fix(submit): render slide cover preview as a real swiper

Replace the static first-image preview with the reference theme's
.new-swiper contract (loop + autoplay + prev/next + pagination) in both
the server-rendered box and the JS re-render, and run auto_fun for
slide covers so new_swiper initializes them.
This commit is contained in:
2026-09-06 10:39:39 +08:00
parent d0c6c3e431
commit b7f5523874
3 changed files with 54 additions and 5 deletions
+12 -1
View File
@@ -27,7 +27,18 @@ $can_video = !empty($ctx['can_cover_video']);
<?php if ($type === 'image' && !empty($data['url'])) : ?>
<img src="<?php echo esc_url((string) $data['url']); ?>" alt="">
<?php elseif ($type === 'slide' && is_array($data) && !empty($data[0]['url'])) : ?>
<img src="<?php echo esc_url((string) $data[0]['url']); ?>" alt="">
<div class="new-swiper scale-height" data-loop="true" data-autoplay="true" data-interval="2000" style="--scale-height:50%;">
<div class="swiper-wrapper">
<?php foreach ($data as $slide) : ?>
<?php if (!empty($slide['url'])) : ?>
<div class="swiper-slide"><img src="<?php echo esc_url((string) $slide['url']); ?>" alt=""></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-pagination"></div>
</div>
<span class="featured-type-badge"><i class="fa fas fa-image"></i></span>
<?php elseif ($type === 'video') : ?>
<div class="new-dplayer dplayer-scale-height" style="--scale-height:50%;"